App-SortCopies
view release on metacpan or search on metacpan
lib/App/SortCopies.pm view on Meta::CPAN
my $i = 1;
my ($name, undef, $ext) = fileparse($file, qr/\.[^.]*/);
$dest = File::Spec->catfile(
$dup_dir,
"${name}_$i$ext"
) while -e $dest and $i++;
move($path, $dest) or warn $!;
say "Duplicate $file is moved to $dest";
}
else {
$fried{$hash} = 1;
}
}
say "All copies in $src have been moved to $dup_dir!";
}
1;
=head1 SYNOPSIS
This sorts a directory, in a non-recursive way.
Copies of files are moved to a ./copies folder created in the directory being sorted
( run in 3.117 seconds using v1.01-cache-2.11-cpan-d7a12ab2c7f )