exclude a pattern but only in the top level

Paul Slootman paul+rsync at wurtel.net
Wed May 15 06:35:01 MDT 2013

On Wed 15 May 2013, Brian K. White wrote:

> > rsync -avz /foo/ ${DEST}::root/foo/
> This syntax does work in his case, and is easier to read, because it
> ends up using the exact same specification "/foo/" and "/foo/" for
> both source and dest, but the syntax I had was also correct. I no
> longer remember why I always do the way I posted, but I've been
> doing it that way for decades (if you count rcp before rsync).

My reasoning is that if you're transferring a directory, make that
obvious by specifying a trailing slash. But use whatever you're happy
with, just don't complain if things get confusing (which it looked like
was the problem).

> The -f ". filename" syntax is correct it's right in the manual and
> I've been using it for ages.

Well, -f specifies a filter rule. You're using -f to specify a filter
rule to tell rsync to merge in a file with additional filter rules,
which is a bit of a roundabout way. Why not tell rsync directly to read
a file with include/exclude rules by using --exclude-from


More information about the rsync mailing list