There is a small correction.All I know is that there are two files in data.txt and datascript.pl in "C:\files" directory .I dont know where these two files are exactly located inside "C:\files".How to find these two files inside C:\files and then copy?
| [reply] |
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 | [reply] [d/l] |
I changed the script a little bit as below,am geting the following error,the change is am passing the directory location to search as an argument,the location can be a server,how to find these files if it is on some server location?
#!/usr/bin/perl -w
use strict;
use warnings;
use Net::Telnet;
use Net::FTP;
use File::Copy;
use File::Find;
my $modem_build_location;
$dir=$ARGV[0];
opendir(DIR, "$dir") || die "Error in opening dir $dir $!";
print "\n$modem_build_ms\n";
my %files = map {$_ => 1} qw(data.txt datascript.pl);
find(sub {
copy($File::Find::name, '.') or die "Can't cp $_: $!"
if delete $files{$_};
}, $dir);
close DIR;
ERROR:-
Can't cp datascript.pl: at Modem_images.pl line 19.
| [reply] [d/l] |
| [reply] |