Duplicates.pl

Script

 * 1) duplicates.pl
 * 2) Dave Saville December 2003
 * 3) dave@deezee.org
 * 1) dave@deezee.org

use strict; use warnings; use File::Find ;

if ( ! @ARGV ) { print <duplicates.txt EOF exit; }

my %hash;

sub wanted;

while ( my $disk = shift ) { File::Find::find({wanted => \&wanted}, join '', substr($disk, 0, 1), ":/."); }

foreach $_ (sort keys %hash) { next if  @{$hash{$_}} == 1; print "$_\n";

foreach my $thing (@{$hash{$_}}) {   print "\t$thing\n"; } }

exit;

sub wanted { # build a hash of arrays of file locations keyed # by lower cased file names #  tr/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; # lower case push @{$hash{$_}}, $File::Find::name; }

