RegExpr in ---exclude

Wayne Davison wayned at users.sourceforge.net
Mon Jun 24 14:00:02 EST 2002


On Mon, 24 Jun 2002, J.Strohschnitter wrote:
> is it possible to use regular expressions in the exclude-paramter of rsync ?
> For example:
> 
> rsync --exclude "/path/to/*/[Ff][Oo][Ll][Dd][Ee][Rr]"

That's still a valid match pattern (and a poor regular expression --
"/*" would match zero or more slashes as a regex, so that would have to
turn into "/.*").

What you're trying to specify is probably failing due to one or more of
these problem areas:

- You have to use "**" to match any depth of subdirs in between the path
  and the name parts.  I.e.  "/path/to/**/[Ff][Oo][Ll][Dd][Ee][Rr]".

- Excludes anchor starting at the root of the transfer, not the root of
  the file system.  In other words, if you're sending "/path/*", you'd
  have to leave off the "/path" in the exclusion.

- You might want to leave off the path altogether.  Using just the name
  "[Ff][Oo][Ll][Dd][Ee][Rr]" would exclude that name at any point in the
  tree.  This is like specifying "**/[Ff][Oo][Ll][Dd][Ee][Rr]", but it
  also matches in the root dir of the transfer, and is more efficient.

..wayne..





More information about the rsync mailing list