Yet another include/exclude question

Matt McCutchen matt at mattmccutchen.net
Mon Nov 9 19:00:46 MST 2009


On Tue, 2009-11-10 at 09:45 +0800, Thomas Gutzler wrote:
> Thanks everyone for your help, I've got what I want.
> 
> Wayne Davison wrote:
> > On Sun, Nov 8, 2009 at 10:21 PM, Thomas Gutzler
> > <thomas.gutzler at gmail.com <mailto:thomas.gutzler at gmail.com>> wrote:
> > 
> >     I thought --include="/this_dir/" --include="/this_dir/***" would do it,
> >     but it doesn't. The exclude * seems to overwrite the include matches:
> >      [sender] hiding file this_dir/foo because of pattern *
> > 
> > 
> > Order is important.  Whatever matches first, is what takes effect. 
> > Also, *** matches both the dir and its contents, so you could use:
> > 
> >   --include='/this_dir/***' --exclude=*
> 
> It seems to be very picky about the order. Thanks for pointing that out.
> My first attempt has been
> --include="*/" --include="*.foo" --include="*.bar"
> --include="/this_dir/***" --exclude="*"
> which did nothing than *.foo and *.bar. Shuffling it around, I found that
> --include="*/" --include="/this_dir/***" --include="*.foo"
> --include="*.bar" --exclude="*"
> does what I want and it even makes sense.

Those two commands should be equivalent.  If you have a reproducible
case in which they aren't, please share it and we can see if there's a
bug.

I tried the first command and it worked fine for me.  That is, after I
fixed a typo I made in the name of "this_dir", which left the
--include="/this_dir/***" nonfunctional and gave a result like the one
you cited above:

[sender] hiding file this-dir/one because of pattern *

-- 
Matt



More information about the rsync mailing list