Date: Sun, 03 Apr 2005 16:47:19 -0400 From: Chuck Swiger <cswiger@mac.com> To: Robert Slade <bsd@bathnetworks.com> Cc: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: Rsync Setup Message-ID: <42505657.5020304@mac.com> In-Reply-To: <1112560093.15815.19.camel@lmail.bathnetworks.co.uk> References: <1112560093.15815.19.camel@lmail.bathnetworks.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42505657.5020304>