Modern Command Line Tool for FTP Backups

Published by Philipp Schuster on

Output of "--help" of my "ftp-backup" shell wrapper for "lftp" (screenshot).

TL;DR: The convenient CLI-based FTP mirroring tool you wished for (hopefully, lol).

In my previous blog post, I presented lftp as my CLI tool of choice in 2024 to connect to FTP servers to perform a parallel recursive download with FTPS (FTP over TLS). However, lftp is a powerful low-level building block, and you need to know how to use it to mirror a directory via FTP. I created a small convenient bash script wrapper around FTP, optimized for that use-case. The script comes with all the convenient CLI argument parsing that one expects in 2024. I hope this might help others out there, or at least serve as base or inspiration for individual solutions.

My ftp-backup script uses argc for modern argument handling in bash scripts. $ ftp-backup --help prints:

Output of "--help" of my "ftp-backup" shell wrapper for "lftp" (screenshot).
Output of --help of my ftp-backup shell wrapper for lftp (screenshot).

You can find its source code as part of my NixOS config on GitHub. It is possible to use this script on non-NixOS systems, as long as lftp, argc, ansi, and lftp are in PATH.

Philipp Schuster

Hi, I'm Philipp and interested in Computer Science. I especially like low level development, making ugly things nice, and de-mystify "low level magic".


Leave a Reply

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