--compare-dest; I'm missing the boat

Harry Putnam reader at newsguy.com
Fri Jan 16 00:11:36 GMT 2009


Matt McCutchen <matt at mattmccutchen.net> writes:


[...]

>> d1a is carbon copy of d1 but still every last file in d1 is copied to
>> d2. 
>
> Two paragraphs later in the man page:
>
> "If DIR is a relative path, it is relative to the destination
> directory."
>
> So you should use:
>
> rsync -avv --compare-dest="../d1a" d1/ d2/

Ackk, sorry, thats such a hefty manpage I went sluggo on the reading. 
I do get quite a different result following your suggestion.

It does lead to some more confusion on my part... explained below.
[...]

Michal Soltys <soltys at ziu.info> writes:

[...]

> If you specify DIR as a relative link, it will be taken as relative to
> destination dir. That's probably the culprit here.

Yup.

One thing remains that seem not to follow the ideas from the man
page. 

There are a number of single files in d1, and 1 subdirectory.
That subdir has several more subdir and a number of files under it.

Of course the copy of d1 done with `cp -a' takes that subdir and all
its contents right along to the copy.

d1 and the copy d1a are identical mirrors.

Yet when I run:
 rsync -avv --compare-dest="../d1a" d1/ d2/

The subdirectory (named `new') and any subdirectories under it are
copied over, but none of the files.  In other words the full directory
structure minus any plain files.

 ls -d d1/*/
  d1/new/

 ls -d d1a/*/
  d1a/new/

 ls  d2/
  new



More information about the rsync mailing list