in reply to File::Find duplicate question

Hi there. It makes sense to only compare files of the same size so that is why they are compared and output in that order, within each size the output is based on a traversal of a Perl hash, which is essentially random. In order to force all '/' Characters to '\' in the output names, you could change the check_file sub to:

sub check_file { (my $fn = $File::Find::name) =~ tr#/#\\#; -f && push @{$files{(stat(_))[7]}}, $fn; }

Replies are listed 'Best First'.
Re^2: File::Find duplicate question
by Anonymous Monk on Oct 25, 2014 at 13:18 UTC
    Thanks for replying, It must just be my logic - I really thought that you'd check the name first of files, store them in the array then find duplicate names and then MD5 them to see if they are indeed the same. Thanks for the little piece of code.
    (my $fn = $File::Find::name) =~ tr#/#\\#;
    I have a few scripts using File::Find this is handy.