--exclude=/ seems not to work as I want
matt at mattmccutchen.net
Wed Mar 11 05:52:58 GMT 2009
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:
> 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, but then I don't see a strong
argument for issuing a warning on --exclude=/ .
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.
More information about the rsync