develooper Front page | perl.beginners | Postings from May 2007

Upload a directory to remote FTP server

Thread Next
Shu Cho
May 24, 2007 00:26
Upload a directory to remote FTP server
Message ID:
Hi list,

I want to upload a directory to a remote FTP server, is there any nice
solution? Here is my script:

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->put($File::Find::name) if -f;

$dir_to_upload = qw(/data);
find(\&upload_file, @dir_to_upload);


It seems my code is ugly:( Can you guys give me some hints?

Shu Cho <>

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About