Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to use rsync to copy files in one direction only?

For example, suppose we have:



where the files are initially identical.

If one then modifies right/a.txt, then:

rsync -avv left/ right/

will copy right/a.txt onto left/a.txt.

Is it possible to restrict rsync to only copying from left/ to right/ (i.e. prevent it from copying from right/ to left/)?

share|improve this question

2 Answers 2

It should be rsync [OPTION...] SRC... [DEST] so it does work in that direction (unless you switch dest and src).

left/a.txt should be copied to right/a.txt:

$ echo 'left' > left/a.txt
$ echo 'right' > right/a.txt
$ cat left/a.txt && cat right/a.txt
$ rsync -avv left/ right/
sending incremental file list
delta-transmission disabled for local transfer or --whole-file
total: matches=0  hash_hits=0  false_alarms=0 data=5

sent 95 bytes  received 34 bytes  258.00 bytes/sec
total size is 5  speedup is 0.04
$ cat left/a.txt && cat right/a.txt

If there are specific files you don't want included by rsync take a look at --exclude=PATTERN and --exclude-from=FILE.

share|improve this answer
And remember, when in doubt the --dry-run option will show you a list of the files that would have been transferred but not actually perform the transfer. I add this to the start of every rsync just as a precaution, even if I am sure the command is correct. –  slillibri Oct 18 '11 at 22:03
Given the confusion about rsync's operation, it is perhaps worth noting rsync's --update option, which will skip (not sync) files which have a more recent modified time on the receiving side. –  Richard Michael Dec 29 '13 at 22:17

You misunderstand rsync. This command:

rsync -avv left/ right/ 

will not sync anything in right to left. It will, as @atbg says, only sync left to right. Rsync is not a bi-directional syncer. It syncs the dest with the source.

Man page for reference: http://linux.die.net/man/1/rsync

share|improve this answer

Your Answer


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.