include lists

Dave Dykstra dwd at
Tue Oct 2 00:20:53 EST 2001

On Fri, Sep 28, 2001 at 07:11:46PM -0700, Ask Bjoern Hansen wrote:
> hi,
> I am trying to specify to rsync an explicit list of what files to
> transfer.  (I have a daemon that keep track of timestamps of the
> files, so before running rsync I query that daemon to get a list).
> I thought --exclude=* --include=/path/foo --include=/path/bar should
> do it, but I am having no luck.
> Both
> rsync -v --stats -W -a --delete --exclude=* --include=clients/ask/foasd1 rsync://server/module /the/path
> and the same with --include=/[...] just gives me:
> Number of files: 1
> Number of files transferred: 0
> Total file size: 0 bytes
> Total transferred file size: 0 bytes
> Literal data: 0 bytes
> Matched data: 0 bytes
> File list size: 56
> Total bytes written: 133
> Total bytes read: 92
> ?!
> Adding more -v's I see that rsync is happily excluding every
> directory, but not including the --include's I've given.

You've got a couple of mistakes.  Please read over the man page section
on excludes carefully, it is very tricky.

The first mistake is that the --exclude '*' has to be at the end of the
list.  Include/exclude rules are applied in order from left to right.

The second mistake is that you need to explicitly include all parent
directories, or rsync will never recurse down into them to find the files
you want (there's an exception in the rsync 2.3 series and maybe for a
while before that, but it's not there now).

- Dave Dykstra

More information about the rsync mailing list