function drush_dir_md5

8.0.x filesystem.inc drush_dir_md5($dir)
6.x filesystem.inc drush_dir_md5($dir)
7.x filesystem.inc drush_dir_md5($dir)
5.x filesystem.inc drush_dir_md5($dir)
master filesystem.inc drush_dir_md5($dir)

Calculates a single md5 hash for all files a directory (incuding subdirectories)

Related topics

3 calls to drush_dir_md5()
archiveDumpCase::testArchiveRestore in tests/archiveDumpTest.php
Test archive-restore.
archiveDumpCase::testArchiveRestoreNoCore in tests/archiveDumpTest.php
Test archive-restore for a site archive (--no-core).
make_md5 in commands/make/make.utilities.inc
Calculate a cksum on each file in the build, and md5 the resulting hashes.

File

includes/filesystem.inc, line 96
Filesystem utilities.

Code

function drush_dir_md5($dir) {
  $flist = drush_scan_directory($dir, '/./', array('.', '..'), 0, TRUE, 'filename', 0, TRUE);
  $hashes = array();
  foreach ($flist as $f) {
    $sum = array();
    exec('cksum ' . escapeshellarg($f->filename), $sum);
    $hashes[] = trim(str_replace(array($dir), array(''), $sum[0]));
  }
  sort($hashes);
  return md5(implode("\n", $hashes));
}