Find and list duplicates of files (26)

11 Name: #!/usr/bin/anonymous : 2008-04-26 19:02 ID:Heaven

>>6
Good idea. Here is the code. Whole thing is pretty slow though.
To >>8,9,10, look at the topic thanks, faggots.

use File::Find;

sub wanted {
$flen = -s $_;
push @{$sizees{$flen}}, $File::Find::name if -f;
}


find \&wanted, ('.');

while (($k,$v) = each(%sizees)) {
if (scalar @$v > 1) {
foreach (@$v) {
push @{$dups{substr(`md5sum "$_"`,0,31)}}, $_;
}
}
}

while (($k,$v) = each(%dups)) {
if (scalar @$v > 1) {
print "$k:";
foreach (@$v) {
print " [$_]";
}
print "\n";
}
}
This thread has been closed. You cannot post in this thread any longer.