consider the following example:
/source
/source/folder1
/source/folder2
/source/folder3
/destination
/destination/folder2
/destination/folder3
/destination/folder3/mytestfolder1
/destination/folder4
/destination/folder4/mytestfolder1
/destination/folder4/mytestfolder2
I want to sync source to destination but "/destination/folder4/mytestfolder1" must be ignored.
I tried using the exclude parameter
rsync -av --delete --progress --exclude "mytestfolder1" /source/ /destination/
but this ignores all folders named "mytestfolder1".
When I supplied the full path, nothing is ignored since it seems rsync thinks the path is in the source and not on the destination.
rsync -av --delete --progress --exclude "/destination/folder4/mytestfolder1" /source/ /destination/
rsync -av --delete --progress --exclude "destination/folder4/mytestfolder1" /source/ /destination/
I've searched the net but didn't find anything helpful.
Thanks for the help. 🙂
Best Answer
If you use an absolute path in a filter (include/exclude), it's interpreted starting from the root of the synchronization. You aren't excluding a directory in the source, or a excluding a directory in the destination, you're excluding a directory in the tree to synchronize.
Thus: