Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Here is what I want to achieve:

Run Rsync to compare two directories recursively like this:

rsync -r /source /target

but don't actually rsync between the directories. I want the resulting differences to be rsyncd/copied to another 3. directory.

Any ideas?

share|improve this question

1 Answer 1

--compare-dest is your friend here:

rsync -rvn --compare-dest /target/ /source/ /extra_target/

(Remove -v and -n after confirming it works for you)

Here's a shell session showing it:

dennis@lightning:~$ cd /tmp
dennis@lightning:/tmp$ mkdir rs1
dennis@lightning:/tmp$ touch rs1/f1
dennis@lightning:/tmp$ rsync -av rs1/ rs2/
sending incremental file list
created directory rs2
./
f1

sent 96 bytes  received 34 bytes  260.00 bytes/sec
total size is 0  speedup is 0.00
dennis@lightning:/tmp$ touch rs1/f2
dennis@lightning:/tmp$ rsync -avn rs1/ rs2/
sending incremental file list
./
f2

sent 71 bytes  received 18 bytes  178.00 bytes/sec
total size is 0  speedup is 0.00 (DRY RUN)
dennis@lightning:/tmp$ rsync -avn rs1/ rs3/
sending incremental file list
created directory rs3
./
f1
f2

sent 49 bytes  received 15 bytes  128.00 bytes/sec
total size is 0  speedup is 0.00 (DRY RUN)
dennis@lightning:/tmp$ rsync -rnv --compare-dest /tmp/rs2/ rs1/ rs3/
sending incremental file list
created directory rs3
f2

sent 49 bytes  received 15 bytes  128.00 bytes/sec
total size is 0  speedup is 0.00 (DRY RUN)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.