How to transfer an entire website via ftp with recursive lftp
Posted by Matteo Mattei ~ 12th January 2009
In these days I’ve to transfer some big websites from a server to another and the only way to do this it was an FTP connection because the destination server did not provide any other type of access. Because of the number of files was big (about 12GB) I’ve created a little script to use with lftp opened into a screen session so don’t make me a terminal busy for days.
So I’ve created a script called sendfiles.sh in this way:
set ftp:ssl-allow no open -u username,password example.com mirror -c -R /source-path /destination-path quit
Where the following fields are respectively:
username: user name for ftp access
password: password for ftp access
example.com: ftp destination server
source-path: source path on local server
destination-path: remote path on the ftp (where / is the ftp rootdir)
To run the script is sufficient to open a screen session (if you want to leave the process in background on the source server) and issue this command:
lftp -f sendfiles.sh
This is an awesome script. Saved me tons of time! Thanks for publishing this.