On Saturday 05 June 2004 HH:58:11, Edward Ludlow wrote:
> philipp traeder wrote:
> > "perldoc Net::FTP" is your friend - there you'll find documentation for
> > the put() method, which should be what you want.
> > Basically, you just need to extend your script a bit - something like:
> >
> > my $ftp = Net::FTP->new(...);
> > $ftp->login("username", "password");
> >
> > # change the working directory on the server
> > $ftp->cwd("dir/where/you/want/to/put/your/file");
> >
> > $ftp->put("name/of/your/local/file");
> >
> > $ftp->quit();
>
> The script now successfully launches two FTP sessions, but how exactly
> do I use put() to move a file from one of the sessions to the other?

Hi Ed,

excuse me - my last post might have been a bit confusing.
The script I sketched was meant to be a complete script, not an extension to 
the script you already wrote.

You need only one FTP session, of course - this session connects to the remote 
FTP server, uploads the file, and disconnects again.

Just take your original script and put something like the following lines 
between the "$ftp->login" and the "$ftp->quit()" lines:

  my $remote_directory = "name/of/the/remote/directory";
  $ftp->cwd($remote_directory)
       or die "Cannot change working directory ", $ftp->message;

  my $filename = "name/of/your/local/file";
  $ftp->put($filename)
       or die "cannot upload file $filename ", $ftp->message;

HTH,

Philipp

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to