different behavior in dry-run than without

Wayne Davison wayned at users.sourceforge.net
Thu Feb 6 19:29:35 EST 2003

On Wed, Feb 05, 2003 at 11:02:16PM -0500, george donnelly wrote:
> however if i remove the leading include */ i get nothing

This tells it to include all directories at every level.  If you don't
want that, you need to specify all the subdirectories you want.

> rsync -rvLRzptgoD --stats --include="*/" --include="/usr/home/*/apache/**"
> --include="/usr/home/*/backmeup/**" --include="/usr/home/**/Data.fs"
> --include="/usr/home/**/reposit/**" --include="/usr/home/*/apache.conf"
> --exclude="*" /usr/home/ /backup/backups/backup.0/

Include/exclude options are relative to the *base* of the transfer.
I.e., unless there's a /usr/home/usr/home dir, the rest of the include
directives won't match anything.  The --exclude=* then tells it to
exclude all files.  The "**/Data.fs" and "**/reposit/**" directives
require that you send all dirs, including all dirs that don't have
anything to do with these directives or rsync will never scan down
into a dir that might possibly match (sad, but that's how rsync

The other problem with rsync is that "/*/apache/**" treats both
wildcards as "**".  I have a bug-fix for this that I plan to check
into CVS soon.

So, something like this would get you at least part of the way there:

rsync -rvLRzptgoD --stats --include="*/" --include="/*/apache/**"
 --include="/*/backmeup/**" --include="/**/Data.fs"
 --include="/**/reposit/**" --include="/*/apache.conf"
 --exclude="*" /usr/home/ /backup/backups/backup.0/

If you want better control of the sending process, you'll have to do a
pre-scan for the "Data.fs" files and the "reposit" dirs and then use a
script to construct a minimal set of directory include/excludes that
just gets you down into those dirs while omitting the others (and also
switch over to using --include-from, so you can input the file this
script will output).


More information about the rsync mailing list