in reply to Re^3: Copying files from a directory to cwd
in thread Copying files from a directory to cwd

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.

Replies are listed 'Best First'.
Re^5: Copying files from a directory to cwd
by wind (Priest) on Apr 21, 2011 at 09:02 UTC

    Change the error message to be more explicit, as the filename alone isn't revealing of what your problem might be:

    copy($File::Find::name, '.') or die "Can't cp $File::Find::name: $ +!"
Re^5: Copying files from a directory to cwd
by Anonymous Monk on Apr 21, 2011 at 06:50 UTC

    Can anyone help?