Hi,
I'm playing around with NET::ftp, and I've run into a problem.
I'm trying to write a script that will automatically FTP files to a remote server.
Here's what I've tried:
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
use Net::FTP;
my $host = "XXX.XX.XXX.XX";
my $username = "UNAME";
my $password = "PASSW";
my $ftpdir = "/";
my $file = "C:\\Today.txt";
#-- connect to ftp server
my $ftp = Net::FTP->new($host) or die "Error connecting to $host: $!";
#-- login
$ftp->login($username,$password) or die "Login failed: $!";
#-- set to binary
$ftp->binary();
#-- chdir to $ftpdir
$ftp->cwd($ftpdir) or die "Can't go to $ftpdir: $!";
#-- upload file
$ftp->put($file) or die "Can't get $file: $!";
#-- close ftp connection
$ftp->quit or die "Error closing ftp connection: $!";
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
When I run the script, I get this error:
"Can't get C:\Today.txt: Bad file descriptor at ftp_test.pl line 26." (that's the line after "#-- upload file"
What am I doing wrong?
When it's up and running, I want the script to look in a folder on the local machine, and upload all the files (40-60 per day) with a .pdf extension to the server. How would I use mput with NET::ftp to do this?
Thanks for your time.
Peter.
I'm playing around with NET::ftp, and I've run into a problem.
I'm trying to write a script that will automatically FTP files to a remote server.
Here's what I've tried:
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
use Net::FTP;
my $host = "XXX.XX.XXX.XX";
my $username = "UNAME";
my $password = "PASSW";
my $ftpdir = "/";
my $file = "C:\\Today.txt";
#-- connect to ftp server
my $ftp = Net::FTP->new($host) or die "Error connecting to $host: $!";
#-- login
$ftp->login($username,$password) or die "Login failed: $!";
#-- set to binary
$ftp->binary();
#-- chdir to $ftpdir
$ftp->cwd($ftpdir) or die "Can't go to $ftpdir: $!";
#-- upload file
$ftp->put($file) or die "Can't get $file: $!";
#-- close ftp connection
$ftp->quit or die "Error closing ftp connection: $!";
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
When I run the script, I get this error:
"Can't get C:\Today.txt: Bad file descriptor at ftp_test.pl line 26." (that's the line after "#-- upload file"
What am I doing wrong?
When it's up and running, I want the script to look in a folder on the local machine, and upload all the files (40-60 per day) with a .pdf extension to the server. How would I use mput with NET::ftp to do this?
Thanks for your time.
Peter.