Rsync Setup
Chuck Swiger
cswiger at mac.com
Sun Apr 3 13:48:47 PDT 2005
Robert Slade wrote:
> Hi, I'm trying to get my brain around rsync. What I am trying to do is
> synchronise 2 directories on different machines. I have an rsync server
> running on one machine and running it as a client on the other. I have
> been able to get this setup to work. However, it just syncs the
> directories on machine A with those on B. If B has a later version of
> the file on A it gets overwritten with the older version from A.
>
> I have done a fair bit of reading on rsync which leads me to believe
> that it will only work one way. Is this correct? If so, is there any
> other way of synchronising the 2 directories so that they end up with
> the latest version of the file(s) from either machine.
You want the "update" -u option:
rsync -auv from to
rsync -auv to from
...as in:
% mkdir from to
% touch from/a
% echo 'hi' > to/a
% touch to/b
% echo 'bye' > from/b
% rsync -auv from to
building file list ... done
from/
from/a
from/b
sent 188 bytes received 60 bytes 496.00 bytes/sec
total size is 4 speedup is 0.02
% rsync -auv to from
building file list ... done
to/
to/a
to/b
to/from/
to/from/a
to/from/b
sent 321 bytes received 100 bytes 842.00 bytes/sec
total size is 7 speedup is 0.02
% cat to/a
hi
% cat to/b
% cat from/a
% cat from/b
bye
--
-Chuck
More information about the freebsd-questions
mailing list