joedarock has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to get a simple file download script working using Net::FTP. Here's my script:
The script seems to run and in fact I can successfully modify it to make and remove directories on the server. What I can't do is get it to download from the server to a local file. Server permissions are set properly, the file exists and the local directory exists. What I get is this error line, and it never gets to the terminating print line.: "Could not get hello.pl from /home/admin/temp Transfer complete. No transfer to ABOR." Can someone point me in the right direction? Joe#!/usr/bin/perl print "Content-type: text/plain\n\n"; use strict; use warnings; use Net::FTP; my $host ='192.168.0.110'; my $user ='root'; my $pw ='xxxxxx'; my $file ='hello.pl'; my $path ='/home/admin/temp'; my $ftp = Net::FTP->new($host, Debug => 1) or die "Could not connect to '$host': $@"; $ftp->login($user, $pw) or die print "Could not login1: %s", $ftp->message; $ftp->cwd($path) or die print "Could not change directory to %spath", $ftp->message +; $ftp->get("hello.pl") or die print "Could not get $file from $path ", $ftp->message; print "End";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::FTP get problem
by poj (Abbot) on Jul 28, 2017 at 18:53 UTC | |
by joedarock (Initiate) on Jul 28, 2017 at 20:32 UTC | |
by poj (Abbot) on Jul 28, 2017 at 20:56 UTC | |
|
Re: Net::FTP get problem
by roboticus (Chancellor) on Jul 28, 2017 at 21:47 UTC | |
by joedarock (Initiate) on Jul 31, 2017 at 11:57 UTC | |
by roboticus (Chancellor) on Jul 31, 2017 at 16:38 UTC | |
by poj (Abbot) on Jul 31, 2017 at 17:45 UTC | |
by joedarock (Initiate) on Aug 01, 2017 at 11:07 UTC | |
by poj (Abbot) on Aug 01, 2017 at 17:26 UTC |