Pages

27 November 2010

FTP synchronization

I have found a very nice way of synchronizing local and remote directories over ftp using lftp and following this easy-to-understand article at linux.com

The procedure is quite simple. To download from the server you need to create a file named download.x and write (with your data):

open -u user,password -p [port] [server]
mirror -c -e /remote_directory /local_directory
exit

To upload files to the server you need to create another file named upload.x and write (with your data):

open -u user,password -p [port] [server]
mirror -c -e -R /local_directory /remote_directory
exit

To download files simply type 'lftp -f download.x' at the command line.
To upload files simply type 'lftp -f upload.x' at the command line.

That's it. Of course you can automatize these actions with cron or anacron.