Excluding files from an rsync

To exclude files from an rsync you can use the --exclude option. But what if you want to exclude several different types of files? Simply use --exclude several times!

rsync -avP --exclude='*.zip' --exclude='*.gz' dir1 dir2

Alternately you can you the --exclude-file=exclude.txt which is just a list of files to exclude, but a lot of times it's easier to just do it on the command line.

Leave A Reply
All content licensed under the Creative Commons License