a problem I'm having with rsync-4.5.4

Wayne Davison wayned at users.sourceforge.net
Mon May 6 00:27:07 EST 2002


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".

..wayne..





More information about the rsync mailing list