http://www.perlmonks.org?node_id=188179

sravan2000 has asked for the wisdom of the Perl Monks concerning the following question:

Can somebody help me in getting the logic to write a perl ftp script which can ftp files from multiple source directories to multiple target directories. Thanks.

Originally posted as a Categorized Question.

  • Comment on FTP files from multiple source directories to multiple target directiories

Replies are listed 'Best First'.
Re: FTP files from multiple source directories to multiple target directiories
by kvale (Monsignor) on Aug 06, 2002 at 23:02 UTC
    The easiest way to do this is to use Net::FTP. Here is a simple bit of code that FTPs a single file:
    use Net::FTP; chdir "/tmp"; $ftp = Net::FTP->new("some.host.name", Debug => 0); $ftp->login("anonymous",'-anonymous@'); $ftp->cwd("/pub"); $ftp->get("that.file"); $ftp->quit;
    Then use this basic idea in a loop over files for each source directory.

    -Mark