#!/usr/bin/perl -w use strict; use File::Find::Duplicates; $|++; # AutoFlush the Buffer &usage if $#ARGV eq '-1'; my %dupes = find_duplicate_files(@ARGV); die "No duplicates found!\n" unless keys %dupes; print "############ Duplicate File Report & Removal Utility ############\n"; my $i = 1; foreach my $fsize (keys %dupes) { print "#" x 64 . " " . $i++ . "\n"; print map {-l $_ ? "# push \@delete, '$_'; # symlinked to " . readlink($_) . "\n": "# push \@delete, '$_';\n"} @{ $dupes{$fsize} }; print "\n"; } print "unlink \@delete;\n"; sub usage { (my $script_name = $0) =~ s#.*/##; # $0 = full path to script print < !!dupes [list of directories] The report generated by the above commands is yet another perl script that can be edited allowing you to flag certain files for removal. The following command will run the report and remove all flagged files. :%!perl Nothing is deleted unless you flag the file by uncommenting the line. If you don't understand how the report works, the following commands should explain it. perldoc -f push perldoc -f unlink =head1 AUTHOR Kingsley Gordon, Ekingman@ncf.caE last modified: Thu Jul 4 15:11:26 EDT 2002 =cut