I want to exclude all the contents of a folder but some of its sub-folders, and I want to do it with just a single rule file without adding --exclude or --include command-line options. Is this possible? A single rule file is important because I find it easier to maintain and document.
I run the following command
rsync -a -F --filter "merge backup-filter" /mnt/home/common /mnt/backup
with file backup-filter:
# non-rooted rules take precedence
+ .git/*
+ .gitignore
- .*.sw?
# rooted rules
+ /common/backup*
- /common/opt/
+ /common/usr/
# FIXME
+ /common/root/startup/*
+ /common/root/.config/gopt/*
- /common/root/*
The rule block starting at FIXME is the broken piece. It is meant to exclude all the contents of /common/root but let the contents of startup and .config/gopt be copied. It is broken because startup and .config/gopt aren't copied.
As time goes by, I plan on adding more excluded paths at various levels and some included sub-paths like I'm doing here for the /common/root path. So the rule file is going to grow considerably.
- - , .
برچسب:
نویسنده: استخدام کار