need rsync.conf exclude example

Wayne Davison wayned at
Fri Oct 7 17:54:44 GMT 2005

On Fri, Oct 07, 2005 at 09:44:40AM -0700, Jon Drukman wrote:
> my intent is to prevent the "promos" and "misc" subdirectories 
> from being copied from client to server.  this is not functioning 
> though.

What version of rsync are you running?  I don't see a problem with a
similar test using 2.6.6.  However, there can be a problem if you
specify partial pathnames in the server excludes (as you are doing)
depending on how deep in the hierarchy the user's copy request was.
So, maybe you ran into this problem:

Assume there is a directory "/foo/bar/baz" in the module's hierarchy.
If you "exclude = bar/baz/" and the user requests "/foo/bar/", rsync
will copy the contents of the "bar" dir, including the "baz" dir it
contains because there is no "bar" dir in the transfer (since the "baz"
dir is at the root of this particular transfer).  I do consider this
behavior a bug (with respect to server excludes only), so hopefully this
will be fixed in the future, but in the meantime, there is an easy
workaround -- switch to using filter:

If you specify this config-file option:

        filter = -/ foo/bar/  -/ foo/bar2/

That will match the two exclude rules against the whole path (due to the
'/' option), making the rules always work.  This obviously requires that
the server be running a version of rsync that supports filter, so make
sure you're using 2.6.6 (or a sufficiently patched version of 2.6.4,
such as the one in debian stable).

The alternative to using "filter" is to use an absolute pathname in your
exclude command (e.g. "exclude = /baz/foo/bar/") or to specify an
exclude that does not rely on a subdir check (e.g. "exclude = bar/").


More information about the rsync mailing list