a problem I'm having with rsync-4.5.4

Dave Dykstra dwd at bell-labs.com
Tue May 7 17:21:42 EST 2002

On Mon, May 06, 2002 at 12:24:27AM -0700, Wayne Davison wrote:
> On Sun, 5 May 2002 George.R.Goffe at seagate.com wrote:
> > When I run rsync I ask rsync to exclude anything */nsr* in an excludes
> > file.
> Since '*' doesn't match '/', that will only match an nsr* name one level
> deep in the transferred tree (i.e. /usr/FOO/nsr*, where FOO is any
> directory in /usr).  If you just use "nsr*", it will match the name at
> any level, which is probably what you want.  If you really didn't want
> to exclude nsr* items at the bottom-most level (i.e. in /usr in this
> case), you could use "**/nsr*" which ensures that the exclusion was
> occurring at least one directory deep (since ** _does_ match '/').
> I note that the man page is a little deceiving on this issue.  While it
> says that a pattern that includes a '/' is matched against the whole
> path+filename, it also says that only patterns that start with a '/' are
> matched against the start of the path, and all others are matched
> against the end.  So, it could be construed that a pattern of "foo/bar"
> should exclude any file bar in a directory named foo (e.g. both /foo/bar
> and /baz/foo/bar).  The man page should be improved a bit to say that
> both an initial and an interior slash cause us to match from the start
> of the path+filename, so "foo/bar" is the same as "/foo/bar".

I'm not sure your interpretation is completely accurate; I think that rsync
intends to implement it the way as described but it is a bug in its
implementation that's very hard to fix.  Maybe it comes down to your
description; if so it shouldn't be as hard to explain in the man page as I
thought.  See


- Dave

More information about the rsync mailing list