Hi list,
I want to upload a directory to a remote FTP server, is there any nice
solution? Here is my script:
#!/usr/bin/perl
use Net::FTP;
use File::Find;
$ftp = Net::FTP->new("host", Port => 1234);
$ftp->login("usr", "passwd");
sub upload_file {
$ftp->mkdir($File::Find::name, 1) if -d;
$ftp->cwd($File::Find::name);
$ftp->put($File::Find::name) if -f;
}
$dir_to_upload = qw(/data);
find(\&upload_file, @dir_to_upload);
$ftp->quit();
It seems my code is ugly:( Can you guys give me some hints?
TIA
--
Shu Cho <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/