Selective sync
Wayne Davison
wayned at users.sourceforge.net
Wed Aug 14 10:54:01 EST 2002
On Wed, 14 Aug 2002, Ivan Kovalev wrote:
> rootdir/*/2002-08-01
> rootdir/*/*/1-Aug-02
> rootdir/*/2002-08/01
As the documentation states, if you use --exclude=*, you need to include
every parent directory on the way down to the directories in question.
So, it's easy to see that the rules you gave will never allow the decent
into the subdirs needed to find the 2002-08-01 dir because these subdirs
get excluded by the "*" before they are ever read.
Since the directories you require are not at the same level from the
root, you're probably going to need to be pretty specific about what
directories to allow leading up to this deeper dir. If we assume that
this directory is either in the subdir "foo" or "bar", the following
include file would work (with no trailing exclude of "*"):
+ /*/
- /*
+ /*/2002-08-01/
+ /*/2002-08/
+ /*/foo/
+ /*/bar/
- /*/*
+ /*/*/1-Aug-02/
+ /*/2002-08/01/
- /*/2002-08/*
This may transfer a few extra (empty) subdirs on the way down to the
2002* dirs, but that can only be avoided by getting more specific with
the first-level include/exclude directives (like we did with the second
level directives). On the flip side, you could replace the two lines
that specify second-level dirs (the "foo" and "bar" lines) with a single
line that specified "+ /*/*/" if you don't mind having empty 2nd-level
dirs that didn't have a 1-Aug-02 dir in them.
Note that I prefer using limited exclusions like those above instead of
a catch-all --exclude='*' because it makes it easier to include the
contents of directories (since the default is to include everything that
does not match one of the include/exclude rules). It also avoids
improper parsing of a rule like this:
+ /*/2002-08-01/**
This is trying to allow an entire tree of files in a directory one level
deep, but it actually gets parsed like this:
+ /**/2002-08-01/**
which can sometimes cause problems.
..wayne..
More information about the rsync
mailing list