include and exclude file
hashproduct at gmail.com
Sat Apr 15 15:39:38 GMT 2006
On Sat, 2006-04-15 at 02:58 -0400, Marc Collin wrote:
> would like to backup kmail and kwalet in my include file i do:
This is a very common problem that people encounter with includes. If
you exclude .kde, rsync won't even go inside, so it won't notice
that .kde/share/apps/kmail is included.
There are three solutions. I give example filter files that contain
both includes (+) and excludes (-). You pass a filter file filters.txt
to rsync using the option: --filter=". filters.txt"
(1) Show rsync the way to your kmail and kwallet directories by
including the directories along the path. Advantage: It works.
Disadvantage: the include/exclude files are annoying to write, although
I think there's a script somewhere that writes them for you.
Variant 1 (at each level, tell rsync not to stray from the path):
Variant 2 (exclude everything and then re-include subtrees):
(2) Include all directories, but only include files under the
directories you want. Then prune empty directories. Advantage: the
include/exclude files are really easy to write. Disadvantages: rsync
traverses the whole tree, and if there happen to be empty directories in
the areas you want transferred, they will be skipped.
Give rsync the option --prune-empty-dirs.
(3) My favorite technique. Sneak under the exclude rule by giving rsync
extra source arguments with --relative. Advantage: works, and you
rarely need any include rules. Disadvantage: somewhat tricky.
Use a command like this:
rsync --relative $BDIR/./ $BDIR/./.kde/share/apps/kmail/
More information about this technique:
hashproduct at verizon.net
More information about the rsync