App-MarkFiles
view release on metacpan or search on metacpan
bin/mark-cp view on Meta::CPAN
#!/usr/bin/env perl
use warnings;
use strict;
use 5.10.0;
use App::MarkFiles qw(each_path);
use File::Basename;
use File::Copy;
use File::Spec;
use Getopt::Long;
each_path(sub {
my ($path) = @_;
unless (-e $path) {
say "No such file: $path";
return;
}
my ($source_basename, $source_path) = fileparse($path);
my $target = File::Spec->catfile('.', $source_basename);
if (-e $target) {
say "Warning: $path will overwrite $target";
# See mark-mv for some discussion of what happens if target exists.
}
if (copy($path, './')) {
say "Copied: $path";
} else {
say "Copy failed: $!"
}
});
( run in 0.389 second using v1.01-cache-2.11-cpan-a1f116cd669 )