Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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:

share|improve this answer

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

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.