chimni has asked for the wisdom of the Perl Monks concerning the following question:
use Net::FTP; # Create connections to both remote servers... $ftpf = Net::FTP->new('unix system') or die "Can't connect to 'from': +$!"; $ftpd = Net::FTP->new('windows system') or die "Can't connect to 'dest +': $!"; # ...and login to them. $ftpf->login('anonymous') or die "Can't login to 'from'"; $ftpd->login('anonymous') or die "Can't login to 'dest'"; # Place both servers into the correct transfer mode. # In this case I'm using ASCII. $ftpf->ascii() && $ftpd->ascii() or die "Can't set ASCII mode: $!"; # Send the PASV command to the destination server. # This returns a port address. $port = $ftpd->pasv or die "Can't put FTP host in passive mode: $!"; print $port; # Send the port address to the source server so it # knows where to send the data. $ftpf->port($port) or die "Error sending port: $!"; # Send the RETR and STOU commands to the servers $rfile = '/pub/swdistrib/conf/os.conf'; $ftpf->retr($rfile) or $ftpf->ok or die "Can't retrieve '$rfile': $!"; + $sfile = '/swdistrib/os.conf'; $ftpd->stou($sfile) or die "Can't store '$sfile': $!"; # Wait for the transfer to complete $ftpd->pasv_wait($ftpf) or die "Transfer failed: $!"; $ftpd->close() && $ftpf->close() or die "Can't close connections: $!"; + $ftpf->quit() && $ftpd->quit() or die "Can't quit ftp connections: $!" +;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net:FTP:Recursive: between unix and windows host launched from another windows host
by Mr. Muskrat (Canon) on Mar 26, 2004 at 04:48 UTC | |
|
Re: Net:FTP: between unix and windows host launched from another windows host
by TilRMan (Friar) on Mar 26, 2004 at 06:18 UTC | |
by saldanajg (Initiate) on Nov 01, 2010 at 16:23 UTC | |
|
Re: Net:FTP: between unix and windows host launched from another windows host
by diskcrash (Hermit) on Mar 26, 2004 at 06:11 UTC |