Re: Upload a directory to remote FTP server Hi,

Did you try to use Net::FTP::Recursive (http://search.cpan.org/~jdlee/Net-FTP-Recursive-2.00/Recursive.pm)
It seems to fit to your task.

Yaron Kahanovitch

----- Original Message -----
From: "Shu Cho" 
To: beginners@perl.org
Sent: Thursday, May 24, 2007 10:26:00 AM (GMT+0200) Auto-Detected
Subject: Upload a directory to remote FTP server

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 


-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/




-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


