in reply to Sync via FTP

Although a nice challenge for a Perl program this problem has been solved before.

You may want to have a look at the open source program wget and its option -mirror that is able to mirror a directory tree located on a remote system provided that system has an ftp server running. Most distributions ship wget as a standard utility so it's likely on your system already.

As usual you can embed wget in a Perl program to feed it directory trees to mirror etc. ;-)