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

Michal Soltys soltys at ziu.info
Thu Jan 15 23:09:06 GMT 2009

Harry Putnam wrote:
> I must be seriously misunderstanding the man page coverage of
> --compre-dest.  My take was that if a file  in compare-dest=dir
> matches a file in SOURCE/ then it won't be transferred to DEST/.
> I tried this test. (d1 has single files and 2 subdir with files)
>    cp -a d1 d1a
>    mkdir d2
> rsync -avv --compare-dest="./d1a" d1/ d2/
> d1a is carbon copy of d1 but still every last file in d1 is copied to
> d2. 

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

mkdir d2
cp -a d1 d2/d1a
rsync -avv --compare-dest="./d1a" d1/ d2/

...should do the thing. Or just specify DIR as absolute.

More information about the rsync mailing list