--exclude=/ seems not to work as I want

Cameron Simpson cs at zip.com.au
Wed Mar 11 07:26:04 GMT 2009


On 11Mar2009 01:52, Matt McCutchen <matt at mattmccutchen.net> wrote:
| On Wed, 2009-03-11 at 16:13 +1100, Cameron Simpson wrote:
| > I know this may seem nonsensical, but I wanted to issue an rsync
| > invocation that synced nothing at all. (I wanted to avoid a sync by
| > fiddling a config file in some automation rather than changing to
| > auomation to have a skip-the-rsync mode.)
| > 
| > Anyway, it seems to me with rsync-3.0.5 that one of:
| > 
| >   --exclude=/
| >   --exclude=/*
| >   --exclude=*/
| > 
| > ought to omit the _entire_ directory tree. In fact, the first seems to do
| > nothing (the whole tree gets synced) and the latter two omit everything
| > except the top directory itself.
| > 
| > I had hoped to omit everything including the top directory, thus making no
| > changes of any kind to the target (yes, I know -n will do that too:-)
| > 
| > Any thoughts? I would have hoped the first (the no-op) would do,
| > and feel that maybe it should at least elicit an error message.
| 
| The root directory of the transfer cannot be excluded.  That should
| probably be stated in the man page,

That would be very nice, yes.

| but then I don't see a strong
| argument for issuing a warning on --exclude=/ .

Not if the afore mentioned corner case is in the manual entry.

However, thinking on this and also on some programmatically constructed
include/exclude lists I've sometimes made, I can see a use for a
debug/verbosity mode that reports include/exclude patterns that never
matched, post sync.

| To make rsync a no-op, you can use --list-only (which is stronger than
| -n in that it doesn't access the destination at all) with --exclude='/*'
| to avoid scanning most of the source.  Or you could even change the
| command name from "rsync" to "true".  If those ideas are unacceptable to
| you, please explain why and I'll try to come up with something else.

No, these are all viable suggestions. Thank you.

I was merely seeing just how far I could go by fiddling only the
include/exclude stuff and was surprised by the ineffectiveness of
"--exclude=/".

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

There is a chasm
of carbon and silicon
the software can't bridge
- Haiku Error Messages http://www.salonmagazine.com/21st/chal/1998/02/10chal2.html


More information about the rsync mailing list