lftp is a command-line FTP client with several advanced file transfer features. For example, lftp can upload or download a whole directory tree recursively and selectively, or resume interrupted file transfers. A popular use case of lftp is to mirror local files or folders to a remote FTP server. While rsync is a popular mirroring software tool, it uses its own file synchronization protocol, and so does not work over FTP.
If you would like to backup local files or directory trees to a remote FTP server, you can proceed as follows.
To install lftp on Debian, Ubuntu or Linux Mint:
To install lftp on CentOS, Fedora or RHEL:
Now go ahead and run iftp command as follows. Note that $username, $password and $ftp_hostname need to be populated according to your FTP server setup.
mirror --reverse --delete --parallel=3 --older-than='now-7days' --exclude-glob .git"
- "--reverse" option means uploading files to a remote FTP server.
- "--delete" option means removing files not present in the source directory.
- "--parallel=3" option means uploading upto 3 files in parallel.
- "--exclude-glob .git" option means excluding matching folders (e.g., .git).
- "--older-than='now-7days'" option means uploading files which were modified more than seven days ago.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015