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.



Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.144.48.135
To prevent spam please submit by clicking the kitten: