Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Recursive Directory Comparison Tools

by mp (Deacon)
on Sep 03, 2002 at 17:30 UTC ( [id://194826]=note: print w/replies, xml ) Need Help??


in reply to Recursive Directory Comparison Tools

I've done this type of thing before by using File::Find along with Digest::MD5 and stat() to recursively walk through a directory and create a "file status" file for both directories. The file status files can be sorted by filename, then "diff"-ed to show differences between the two directory trees. The format of the file status file looked something like this: (pipe-delimited).
dir1/path/to/file1|MD5checksum_of_file_content|last_modified_time|perm +s|... dir1/path/to/file2|MD5checksum_of_file_content|last_modified_time|perm +s|... ...
To get started easily, you can run 'find2perl dir1' to build the code for you, then edit the contents of sub wanted to print the various attributes that you want compared.

If you need to do directory synchronization, you may also find unison to be useful.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://194826]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-18 02:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found