title: Can I get the MD5sum of a directory with Perl?
body: <p>I am writing a Perl script (in Windows) that is using File::Find to index a network file system.  It works great, but it takes a very long time to crawl the file system.  I was thinking it would be nice to somehow get a checksum of a directory before traversing it, and it the checksum matches the checksum that was taken on a previous run, do not traverse the directory.  This would eliminate a lot of processing, since the files on this file system do not change often.</p>
  
  <p>On my AIX box, I use this command:</p>
  
  <pre><code>csum -h MD5 /directory
  </code></pre>
  
  <p>which returns something like this:</p>
  
  <pre><code>5cfe4faf4ad739219b6140054005d506  /directory
  </code></pre>
  
  <p>The command takes very little time:</p>
  
  <pre><code>time csum -h MD5 /directory
  5cfe4faf4ad739219b6140054005d506  /directory
  
  real    0m0.00s
  user    0m0.00s
  sys     0m0.00s
  </code></pre>
  
  <p>I have searched CPAN for a module that will do this, but it looks like all the modules will give me the MD5sum for every file in a directory, not for the directory itself.</p>
  
  <p>Is there a way to get the MD5sum for a directory in Perl, or even in Windows for that matter as I could call a Win32 command from Perl?</p>
  
  <p>Thanks in advance!</p>