I need to use rsync to synchronize several directories from an rsync server. The whole rsync module is quite large and I like to avoid coping the other, not required parts as well.
I have the wanted directories as text file but have problems creating a proper filter rule file. My requirements are as follows:
- Include only directories in my list with all files and subdirectories in them.
- Files in the included directories should be deleted if they are deleted on the server.
- However all
.hgdirectories (Mercurial repository) located on my site but not on the server, and all files and subdirectories in them, should not be deleted.
- Excluded directories should not be deleted.
So far I created a filter file which looks like this
include sub/dir/I/want/*** include other/sub/dir/I/want/*** ... protect .hg/*** exclude **
But this excludes everything apparently. Without the
exclude line all other files are also included.