on Mon, 03 Jun 2002 17:56:18 GMT, [EMAIL PROTECTED] (Jeremy T. Miller) wrote:
> So, a folder having these files: > > HTTPLogWed 32 kb > HTTPLogWed1 32 kb > HTTPLogWed2 32 kb > HTTPLogWed 42 kb That's impossible. You cannot have two file with the same name in the same folder. Furthermore, equal file size does not guarantee that the files are the same. > Can Perl do this? If so, does anyone have any advice/code/hints? I would use Digest::MD5 to create a hash (with the MD5 digest as key) of arrayrefs containing the filenames: #! perl -w use strict; use Digest::MD5; my $dir = 'c:/'; my %dups = (); # If you want to span multiple directories, use File::Find # instead of opendir-readdir-closedir opendir DIR, $dir or die "Cannot open directory $dir: $!"; my @files = readdir DIR; closedir DIR; for (@files) { my $fullname = "$dir$_"; next if -d $fullname; # skip directories open(FILE, "<$fullname") or warn "Can't open '$fullname': $!"; binmode(FILE); push @{$dups{Digest::MD5->new->addfile(*FILE)->hexdigest}}, $fullname; close(FILE); } for (keys %dups) { print "duplicates: @{$dups{$_}}\n" if @{$dups{$_}} > 1; # or do whatever you want with the duplicates } -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]