use File::Copy; use File::Find; use strict; use warnings; my %files = map {$_ => 1} qw(data.txt datascript.pl); find(sub { copy($File::Find::name, '.') or die "Can't cp $File::Find::name: $ +!" if delete $files{$_}; }, 'C:\\files');
Update: change error message to display full path instead of just file name
In reply to Re^3: Copying files from a directory to cwd
by wind
in thread Copying files from a directory to cwd
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |