This is a cheat-sheet for the
rsync syntax with examples for different use-cases I needed in the past. It is not meant as a full tutorial about
Exclude single file or directory
If you only want to exclude a single file or directory, you can use the parameter
[tux@server]$ rsync -a --exclude="path/to/exclude" source destination
You can use an exclude list with
rsync. Just create a file and add one entry per line.
exclude-list.txt */node-modules/* secret-file.txt path/to/a/nested/file.pdf
When running the
rsync command, you need to include the list with the
[tux@server]$ rsync -a --exclude-from="path/to/exclude-list.txt" source destination
Delete additional files
If you set the
rsync will delete files in the destination, that are not present in the source.
[tux@server]$ rsync -a --delete source destination
--progress flag to get an progress-indication. This is more useful for larger files, since the progress is on a per-file-basis. If you have lots of small files, you will only clutter up your output.
[tux@server]$ rsync -a --progress source destination