Back to Toolbox

rclone recipes

Installation

You can download rclone from the official website. On macOS you can also install it with Homebrew: brew install rclone.

Recipes for syncing things

Sync a website to a remote host via (S)FTP

The myremotehost FTP host is defined using the rclone config command, which starts an interactive configuration process.

💡 Pro tip: Before performing a potentially destructive and/or irreversible operation, it is advisable to first test it with the --dry-run option, which prints out what would happen when the command is run without the flag.

To copy the content of the my-stuff folder into the their-stuff folder on the myremotehost FTP host:

rclone copy my-stuff myremotehost:their-stuff --progress --ftp-concurrency 4 --checkers 2 --transfers 2 --exclude-from=".rclone-exclude"

In the command above, the --exclude-from option prevents some files from being copied over. The files are defined as glob patterns, similar to .gitignore.

To copy a file regardless of timestamp, you can use the --ignore-times flag.

rclone copy my-file.txt myremotehost:their-stuff --progress --ignore-times

FTP servers are a heterogenous bunch, and occasionally a server will advertise support for a feature, but then break when the client tries to use said feature. For these situations, rclone has a bunch of --ftp-disable-* flags you can use on your FTP connections.

You can get a sense of what is causing the transfer to fail or hang by using the --dump headers --dump bodies pair of options, which instruct rclone to print out the communication between the FTP client and server. For example, if the server hangs at the EPSV command, we can use the --ftp-disable-epsv flag to disable the feature:

rclone copy my-stuff myremotehost:their-stuff --ftp-disable-epsv --progress --ftp-concurrency 4 --checkers 2 --transfers 2 --exclude-from=".rclone-exclude"