RSYNC

Matt McCutchen matt at mattmccutchen.net
Tue Dec 4 04:21:03 GMT 2007


On Tue, 2007-12-04 at 09:37 +1100, Kevin Johnson-Bade wrote:
> There are some odd things with rsync where the first triggered rule
> philosophy seems to break down, in that an exclude * will override a
> preceding include whatever.

Please keep discussion of rsync that may be useful to others on the
list.

What you are seeing is probably that, with --recursive, exclusion of a
directory stops rsync from traversing it and noticing any included files
within.  The right way to think of "include" is "don't exclude"; rsync
still has to get to the file.  This is mentioned in the man page (search
for the word "ineffectual"), but it still trips a lot of people up.
Here are three ways you could fix the problem:

1. Add high-priority includes for the ancestors of the files/directories
you want rsync to see.

2. Use a separate "find" command to make a list of the files/directories
rsync should copy, and provide the list to rsync using --files-from .

3. The crude but easiest approach: upgrade to rsync 2.6.7 or newer, add
a high-priority --include='*/', and pass --prune-empty-dirs.
Unfortunately, this will lose empty subdirectories in the areas that you
do want to copy.

Matt



More information about the rsync mailing list