From owner-freebsd-questions@FreeBSD.ORG Sun Apr 3 20:48:47 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9408516A4CE for ; Sun, 3 Apr 2005 20:48:47 +0000 (GMT) Received: from pi.codefab.com (pi.codefab.com [199.103.21.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5249443D41 for ; Sun, 3 Apr 2005 20:48:47 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from localhost (localhost [127.0.0.1]) by pi.codefab.com (Postfix) with ESMTP id C57F15DC9; Sun, 3 Apr 2005 16:48:46 -0400 (EDT) Received: from pi.codefab.com ([127.0.0.1]) by localhost (pi.codefab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 77348-06; Sun, 3 Apr 2005 16:48:46 -0400 (EDT) Received: from [192.168.1.3] (pool-68-161-53-96.ny325.east.verizon.net [68.161.53.96]) by pi.codefab.com (Postfix) with ESMTP id C84445DB3; Sun, 3 Apr 2005 16:48:45 -0400 (EDT) Message-ID: <42505657.5020304@mac.com> Date: Sun, 03 Apr 2005 16:47:19 -0400 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041217 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Robert Slade References: <1112560093.15815.19.camel@lmail.bathnetworks.co.uk> In-Reply-To: <1112560093.15815.19.camel@lmail.bathnetworks.co.uk> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at codefab.com cc: "freebsd-questions@freebsd.org" Subject: Re: Rsync Setup X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2005 20:48:47 -0000 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