J
John Davis
I'm trying to use the Net::FTP module in an "mput" like way, but it
does not seem to work correctly. I have a script that gets any number
of files from another server and put them in a directory called
"/tmp/dbinfo"
From /tmp/dinfo, I want to mput all of those files that are in the
directory with the db.out attached to the name, and only those files.
So files such as acedb.out, testdb,out are good, etc.
From my code below, it continues to say that files such as acedb.out,
testdb.out cannot be accessed. If that because the local currently
directory is not set right? I have a chdir (/tmp/dbinfo) - where the
files are, but it cannot put them onto the remote host.
I've moved the chdir around but without success...
Any ideas?
Thanks!
---------------------
#!/opt/perl/bin/perl -w
use strict;
use Net::FTP;
my ($hostname, $username, $password, $directory, $ftp, @last);
$hostname="dbmaster1";
$username="ftp";
$password="nothing";
$directory="/incoming";
my @filelist;
my $file;
chdir ("/tmp/dbinfo");
opendir (DIR, "/tmp/dbinfo") || die "Can't open: $! \n";
@filelist=readdir(DIR);
closedir(DIR);
$ftp=Net::FTP->new ($hostname);
$ftp->login($username, $password);
$ftp->cwd ($directory);
foreach $file (@filelist) {
next if ! ($file=~/db.out/) ;
$ftp->put("$file");
}
$ftp->quit;
does not seem to work correctly. I have a script that gets any number
of files from another server and put them in a directory called
"/tmp/dbinfo"
From /tmp/dinfo, I want to mput all of those files that are in the
directory with the db.out attached to the name, and only those files.
So files such as acedb.out, testdb,out are good, etc.
From my code below, it continues to say that files such as acedb.out,
testdb.out cannot be accessed. If that because the local currently
directory is not set right? I have a chdir (/tmp/dbinfo) - where the
files are, but it cannot put them onto the remote host.
I've moved the chdir around but without success...
Any ideas?
Thanks!
---------------------
#!/opt/perl/bin/perl -w
use strict;
use Net::FTP;
my ($hostname, $username, $password, $directory, $ftp, @last);
$hostname="dbmaster1";
$username="ftp";
$password="nothing";
$directory="/incoming";
my @filelist;
my $file;
chdir ("/tmp/dbinfo");
opendir (DIR, "/tmp/dbinfo") || die "Can't open: $! \n";
@filelist=readdir(DIR);
closedir(DIR);
$ftp=Net::FTP->new ($hostname);
$ftp->login($username, $password);
$ftp->cwd ($directory);
foreach $file (@filelist) {
next if ! ($file=~/db.out/) ;
$ftp->put("$file");
}
$ftp->quit;