Is it possible to use rsync to copy files in one direction only?
For example, suppose we have:
left/a.txt
right/a.txt
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/
)?
You misunderstand rsync. This command:
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
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 toright/a.txt
:If there are specific files you don't want included by rsync take a look at
--exclude=PATTERN
and--exclude-from=FILE
.