[PLUG] Comparing files
Roderick A. Anderson
raanders at cyber-office.net
Tue Nov 9 20:24:43 UTC 2010
Daniel.Roberts at sanofi-aventis.com wrote:
> Hello All
> I have copied thousands of files from one windows fileshare onto another
> windows fileshare.
> How can I easily verify that the file copy is correct?
> I intentionally changed the directory structure between the source and
> the destination.
> I am trying to use md5sum on recursively through every file in every
> directory between the two fileshares and then I would compare the sums
> in a small database.
>
> Question is:
> How do I get md5sums recursively through a directory structure for ever
> file using cygwin installed on my laptop?
> Thanks for any help!
Here's my $0.02 of input.
In my case it was bunch of image files (from scans and cameras) that
kept getting uploaded or moved about on the SAMBA server. I wanted to
find any duplicates.
I resorted to this Perl script
#!/usr/bin/perl
use Digest::MD5 qw(md5_hex);
my $file = $ARGV[0];
print STDERR $file . "\n";
my @ary = split( '/', $file);
my $filename = $ary[$#ary];
my $pathname = join('/', @ary[ 1 .. $#ary -1 ]);
open( FILE, $file );
binmode( FILE );
my $tmpchk = Digest::MD5->new->addfile( *FILE )->hexdigest;
close( FILE );
print join( "\t", $tmpchk, $filename, $pathname) ."\n";
Then sorted the output file and looked for two or more lines with the
same md5sum.
\\||/
Rod
--
> Dan
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
More information about the PLUG
mailing list