Finding Duplicates based on Filename
June 22, 2010 Leave a Comment
Found this brilliant snippet utilising Perl to find duplicates based on filename only, not comparing size (fdupes wins this!)
Full credit goes to radoulov, a member of unix.com forums and cursory link to post in thread
perl -MFile::Find -e'
$d = shift || die "$0 dir\n";
find {
wanted => sub {
-f and push @{$u{$_}}, $File::Find::name;
}
}, $d;
@{$u{$_}} > 1 and printf "found %s in: \n\n%s\n\n",
$_, join $/, @{$u{$_}} for keys %u;
' <dirname>
Advertisement