trailing star/double star in --exclude
Wayne Davison
wayned at samba.org
Wed Feb 8 18:07:32 GMT 2006
On Thu, Feb 09, 2006 at 12:45:23AM +0800, Denis Solovyov wrote:
> Is there any difference in rsync behaviour between "--exclude /dir/*"
> and "--exclude /dir/**" (one and two trailing "stars")?
They are usually the same due to how "/dir/*" is enough to stop rsync
from ever getting down to any subdirs inside "dir". The only exception
is when an include preceded it that keeps a subdir of "dir", like this:
+ /dir/subdir/
- /dir/**
Which is shorter than:
+ /dir/subdir/
- /dir/subdir/*
- /dir/*
Also, on the daemon side, it is safer to use "**" in excludes for the
modules in rsyncd.conf (which hides files from the user) to make sure
that the user can't start a transfer from deeper inside the hierarchy
than the exclude matches.
When using an anchored match term, a "**" at the end of the string makes
almost no difference in terms of code efficiency. In other cases it is
usually slightly more efficient to use "*" in places where you don't
really need to use "**" (such as using "- *" instead of "- **").
> Will rsync enter and scan content of dir/ (and thus change access time
> of files and directories) in any of these examples?
Nope.
..wayne..
More information about the rsync
mailing list