Problem with exclusion pattern

John Van Essen vanes002 at umn.edu
Sun Aug 7 01:09:42 GMT 2005


On Sat, 06 Aug 2005, ptitoliv <ptitoliv at frenchsuballiance.cjb.net> wrote:
> Hello everybody,
> 
> I have a little problem using patterns with exclude instruction. I want
> to rsync all my /home excluding all subdirectories "logs" ans "stats".
> So I used the instruction --exclude */logs/* --exclude */stats/* to
> ignore all these directories. While the execution in verbose mode, I see
> that stats directories are ignored but logs directories are not. I don't
> understand this behaviour. Can somebody explain me why logs directories
> are not ignored ?

It would help to show the entire rsync command that you used, as well as
examples of paths that were properly excluded and improperly included.

Firstly, since you didn't enclose the argument in quotes, there's a
chance that the shell expanded it to specific paths.  It's best to
enclose wildcard strings in quotes, or use the "=" argument format.

Secondly, I'm not sure if it's the case, since you didn't provide any
examples, but it could be that the '*/dirname' part needs to match an
intermediate subdirectory, so it won't match dirname in the top level.

To avoid both problems, try

  --exclude=logs/* --exclude=stats/*

That should copy any directory of the given name, but not its contents.

    John


More information about the rsync mailing list