in reply to Monitor directories or files have any change

You could
  1. Create a global hash %db, or use a database etc.
  2. File::Find send data to
  3. if ( -f ) { $file = File::Spec::catfile( FILE_FIND_INFO ); $db{$file} = $Digest::MD5{ $file }; }

  4. Then run again, and either alert the user if one of the MD5s is different, or save the hash using Storable, and compare it to a newley generated hash.

Or something on those lines.


Evan Carroll
www.EvanCarroll.com

Replies are listed 'Best First'.
Re^2: Monitor directories or files have any change
by benlaw (Scribe) on Oct 28, 2005 at 04:43 UTC
    Thanks, Evan Carroll, I found some interest thing in MD5. I try ren file : bigfile.zip (over 200MB) to bigfile.txt , then type echo a >> bigfile.txt, i found MD5 hash value does not change after append "a" in it~ I feel weird in this case, although this is not related to perl topic. ^^"

      That's probably because there is a ctrl-Z (ascii 26) somewhere in the zip file. When you renamed it to .txt, it got treated as a non-binary file and only the contents upto the (first) ctrl-Z got processed. When you appended an 'a' to it an ran it again, the same thing happened. Only the first part of the data to the first ^Z was processed. Hence the md5 didn't change.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.