in reply to file comparison
If you are doing this a lot with large files, computing a cryptographic hash is the way to go. If, on the other hand you are:
1) Working on Windows
2) Working over network shares
3) Not doing too much
This little snippet I threw together the other day to compare the contents of two shares might help:
my $share = '\\\\someserver\\someshare\\"' foreach my $file (@file_list) { my $file2 = $share . $file; if (-e $file2) { my @cmp = `fc $file $file2 | findstr /c:"FC:"`; if ($cmp[0]) { unless ($cmp[0] =~ /no differences/) { print "$file: $cmp[0]"; } } else { print "$file:\n" } } else { print "$file is missing from $share\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: file comparison
by Karger78 (Beadle) on Jun 26, 2009 at 19:58 UTC | |
by ramlight (Friar) on Jun 26, 2009 at 20:13 UTC | |
by Karger78 (Beadle) on Jun 26, 2009 at 20:29 UTC | |
by ramlight (Friar) on Jun 26, 2009 at 21:00 UTC |
In Section
Seekers of Perl Wisdom