How to exclude directories from source with --relative

Matt McCutchen matt at
Tue May 27 19:18:03 GMT 2008

On Mon, 2008-05-26 at 23:40 -0700, Wayne Davison wrote:
> On Mon, May 26, 2008 at 09:46:04PM -0700, Stuart Anderson wrote:
> > 3) Try excluding a/, this does not work:
> > 
> > # rsync -avn --relative --exclude a/ /tmp/source/./a/? /tmp/destination
> That's because 'a' is an implied directory in the longer path that you
> told rsync to transfer.  Implied directories can't be excluded, but
> their attributes can be omitted via --no-implied-dirs.  If you don't
> want it in the transfer, don't specify it (and if you're using wild-
> cards, specify them in such as way as to avoid matching the dir you
> don't want).

I can understand not being able to exclude a/ from the file list while
still transferring stuff under it.  Still, I should be able to exclude
a/ and everything under it by passing --exclude='/a/***' .  But this
doesn't work in rsync 3.0.2: rsync excludes a/b but adds the implied dir
a/ to the file list anyway.  (Obviously, it worked in rsync 2.6.9, which
allowed the user to exclude implied dirs.)  I think rsync should check
whether a source argument is excluded before adding any dirs it implies.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url :

More information about the rsync mailing list