Scheduled file copies or directory sync from local directory to FTP server

If you have a remote FTP server that you need to put files into, and you don’t want to deal with SCP/SFTP passkeys, lftp (http://lftp.yar.ru/) on the local client machine might be for you. It comes with most linux distros (I found it using yum simply as lftp) and one of its most useful traits is to be able to mirror the remote FTP directory to your local one, and vice versa (through –reverse mirror). Here’s some examples:

# verbosely mirror files from FTP server to local dir. -d to show FTP responses
lftp -d -u ftpusername,password -e “mirror –only-newer –verbose /home/ftpusername/tmp /home/localusername/tmp” ftphost.com&

# more quietly mirror files *to* FTP server from local dir.
lftp -u ftpusername,password -e “mirror –reverse –only-newer /home/localusername/tmp tmp” ftphost.com&

Notice the ampersand, which sends the command to the background so you don’t have to keep the terminal window open.

Here are some more links:

http://www.softpanorama.org/Net/Application_layer/Ftp/lftp.shtml
http://www.linux.com/archive/articles/122169
http://how-to.wikia.com/wiki/How_to_use_lftp_as_a_sftp_client
http://www.gsp.com/cgi-bin/man.cgi?section=1&topic=lftp

One Reply to “Scheduled file copies or directory sync from local directory to FTP server”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.