I use rsync as a backup tool to my external hard disk. However I want to save time by no copying useless cache files of several programs. I want to achieve this by omitting every file which is somewhere in the tree under a folder called Cache, cache or cache2 In fact any variations of names which hint to a cache folder in the full path.
They can be in paths like:
.cache/google-chrome/Default/Cache/1e1cb5d5222c54c4_0
.cache/mozilla/firefox/smifthya.default/cache2/entries/15444D7EEEAF61418021BC35F25FD997974458B5
So I try to exclude those cache files from being synched by the following lines so far not successful.
What I tried so far:
rsync -va --delete --exclude={*Cache*, *cache*} /var/www/ $MYEXDISK/www
rsync -va --delete --exclude '*cache*' /var/www/ $MYEXDISK/www
rsync -va --delete --exclude 'cache*' /var/www/ $MYEXDISK/www
rsync -va --delete --exclude={Cache*, cache*} /var/www/ $MYEXDISK/www
Can anybody tell me the corect syntax to exclude any file, in which's path there is a variation of Cache or cache?