A bit of caution from personal experience:

Net::FTP does work, but it's a bit limited. Net::FTP::Recursive solves a few of the problems, but not all. I just had a case where I was fetching 16000+ small (8-15Kbytes) files from a WinNT server on a network with varying loads to a FreeBSD server on which the script resides. It took several hours with Net::FTP and failed to fetch a number of files. It was trying to create a new connection for each file transfer, and timing out with 'Unable to close connection' as its warning on STDERR.

When I manually FTP'd the files, the mget operation took less than 15 minutes, and all the files came across. Seeing this, I dug into man ftp. In there, I discovered (actually, rediscovered: I had done this before on an embedded system) that you can have ftp read its login and command sequence from a file.

From Perl:
use strict; use warnings; # ... chdir('/path/to/put/files/in'); system('ftp', '-N', 'mystartfile', 'ftp.server.com') && die "FTP FAI +LURE: $!\n"; chdir('/where/I/was/before'); # ...
the file mystartfile:
machine ftp.server.com login me password somesillypw binary cd /path/to/fetch/from mget * bye
This code has your Perl program waiting for completion of the FTP transfer. If this is not necessary, write the system command like so:
system('ftp -N mystartfile ftp.server.com &') && die "Couldn't start f +tp transfer: $!\n";

In reply to Re: How to share records between ftp servers? by samizdat
in thread How to share records between ftp servers? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.