Net::FTP and "mput" issue...cannot change local currently directory
From: John Davis (tudmuf2b_at_onebox.com)
Date: 01/30/04
- Next message: Joe Smith: "Re: HTTP::Daemon"
- Previous message: Walter Roberson: "Re: permissions"
- Next in thread: Sisyphus: "Re: Net::FTP and "mput" issue...cannot change local currently directory"
- Reply: Sisyphus: "Re: Net::FTP and "mput" issue...cannot change local currently directory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Jan 2004 13:42:28 -0800
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;
- Next message: Joe Smith: "Re: HTTP::Daemon"
- Previous message: Walter Roberson: "Re: permissions"
- Next in thread: Sisyphus: "Re: Net::FTP and "mput" issue...cannot change local currently directory"
- Reply: Sisyphus: "Re: Net::FTP and "mput" issue...cannot change local currently directory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|