Back to Toolbox

rsync recipes


rsync can be installed on macOS with Homebrew: brew install rsync.

Recipes for syncing things

rsync requires SSH access to the remote host. When that's not available, I use rclone instead over a different protocol (e.g. SFTP).

Sync a website to a remote host

The myremotehost SSH host is defined in the ~/.ssh/config file.

💡 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.

rsync \
--archive \
--compress \
--verbose \
--progress \
--exclude-from=".rsync-exclude" \
--delete-excluded \
--filter="P dont-delete/" \
./dist/ myremotehost:~/public_html/folder