Hi Jas. Jas wrote: > > Still new to using Perl, any help with this is appreciated. > > Code... > #!/usr/bin/perl > # Backup 192.168.0.1 web directory > # to 192.168.0.2 via FTP > > # Begin remote transfer of file to ODIN for storage # > use Net::FTP; > $ftp = Net::FTP->new("192.168.0.2", Debug => 1) > or die "Could establish conneciton to 192.168.0.2: $@"; > > $ftp->login("user", 'password') > or die "Could not login ", $ftp->message;
That's inventive use of quotation marks: double and single quotes and .. > $ftp->put(`../path/to/*-www.tar.gz`) > or die "Could not transfer files ", $ftp->message; .. backticks in two statements! > $ftp->quit; > > Error... > Net::FTP>>> Net::FTP(2.71) > Net::FTP>>> Exporter(5.566) > Net::FTP>>> Net::Cmd(2.24) > Net::FTP>>> IO::Socket::INET(1.26) > Net::FTP>>> IO::Socket(1.27) > Net::FTP>>> IO::Handle(1.21) > Net::FTP=GLOB(0x8133e3c)<<< 220-Development FTP Server > Net::FTP=GLOB(0x8133e3c)<<< FTPd 1.81.00 (Mar 3 2002) Ready > Net::FTP=GLOB(0x8133e3c)<<< 220 Please enter your user name. > Net::FTP=GLOB(0x8133e3c)>>> user user > Net::FTP=GLOB(0x8133e3c)<<< 331 User name okay, Need password. > Net::FTP=GLOB(0x8133e3c)>>> PASS .... > Net::FTP=GLOB(0x8133e3c)<<< 230 User logged in. > sh: line 1: ../path/to/02192004-www.tar.gz: Permission denied > fileparse(): need a valid pathname at /usr/lib/perl5/5.8.0/Net/FTP.pm > line 705 IMO it's best to use single quotes for strings unless you particularly need to interpolate variables or include control characters. The backticks are your problem: they will make Perl shell out to execute the string as a command. The 'sh: line1:' in your error message is the clue. Presumably you don't have execute permission for '../path/to/02192004-www.tar.gz'? Try this and see if it works any better: my $ip = '192.168.0.2'; $ftp = Net::FTP->new($ip, Debug => 1) or die "Could not establish connection to $ip: $@"; $ftp->login('user', 'password') or die 'Could not login ', $ftp->message; $ftp->put('../path/to/*-www.tar.gz') or die 'Could not transfer files ', $ftp->message; HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>