exclude confusion: what does it match against?
Wayne Davison
wayned at samba.org
Fri Mar 26 20:29:03 GMT 2004
On Thu, Mar 25, 2004 at 11:03:31PM -0500, Andrew Pimlott wrote:
> The exact filename tested against include/exclude patterns is not
> always obvious, and the documentation is somewhat ambiguous about it.
> This bites particularly when using patterns starting with '/'.
Yes, this could certainly use some improvement to make things clearer.
I've never liked the description of the patterns being relative to the
destination directory, though, since the patterns also affect files on
the source side. I prefer the phrase "root of the transfer", which
would have to be defined in the documentation.
What about something like this?
The filenames matched against the exclude/include patterns are
relative to the "root of the transfer". If you think of the
transfer as a subtree of names that are being sent from sender
to receiver, the root is where the tree starts to be duplicated
in the destination directory. This root governs where patterns
that start with a / match (see below).
Because the matching is relative to the transfer root, changing
the trailing slash on the source path or changing your use of
the --relative option affects the names you need to use in your
matching. For example, using these rsync commands:
rsync -a /home/me /dest
rsync -a /home/me/ /dest
rsync -a --relative /home/me /dest
the file /home/me/foo/bar would be matched using, respectively:
/me/foo/bar
/foo/bar
/home/me/foo/bar
The easiest way to see what name you should include/exclude is
to just look at the output when using --verbose and put a / in
front of the name (use the --dry-run option if you're not yet
ready to copy any files).
..wayne..
More information about the rsync
mailing list