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.>From man rsync at the explanation of compare-dest:. . . . . . . . . . . . . . . . . .If a file is found in DIR that is identical to the sender's file, the file will NOT be transferred to the destination directory. This is useful for creating a sparse backup of just files that have changed from an earlier backup. Where am I stripping a gear on this?
On Thu, 2009-01-15 at 16:54 -0600, Harry Putnam wrote:> 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.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/ -- Matt
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.