August 29th, 2011, 07:00 AM
Perl script to create an MD5 hash of each file in the directory
It needs to be written in Perl and take up to 3 parameters.
compareDirectories.pl -if [Index File, path and filename] -sd [Source Directory] -dd [Destination Directory]
The purpose of the script will be to create an MD5 hash of each file in the source directory and then compare it to the MD5 hash of each file in the destination directory.
To build this, I would suggest recursing through the source directory to build an index file that maps each fullpath filename to an MD5 hash. After that, take the index file, recurse through the destination directory and taken an MD5 hash of each file and compare it to the equivalent file in the index file. The script needs to be able to support not having a source or destination directory, i.e. if just a source directory is specified, create the index file and quit, if just the destination directory is specified then just use the specified index file and do the compare. Basically cut the program into two distinct functions that can be called all at once or separately. Please build it to run under Linux