Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jan 2013 13:16:40 -0600
From:      dweimer <dweimer@dweimer.net>
To:        <freebsd-questions@freebsd.org>
Subject:   Re: Syncing Two Dirs With Rsync
Message-ID:  <cdf3a6913ccdb206c80ed7a57965b3d4@dweimer.net>
In-Reply-To: <50EF0F1F.8080904@tundraware.com>
References:  <50EF0F1F.8080904@tundraware.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2013-01-10 12:57, Tim Daneliuk wrote:
> I have used rsync for many years to make sure a destination
> machine:directory is kept up-to-date with some source master
> directory.
>
> I now need to find a way to keep two different machine:dirs
> in sync with each other.  But for any given file, I don't know
> which of these is newer so I don't know "which way" to sync.
>
> For example given:
>
> machineA::/dir/foo      machineB:/dir/foo
> machineA::/dir/bar      machineB:/dir/bar
>
> Say the machineA has the newest foo, but machineB has the
> newest bar.  At the end of syncing, I want both machines
> to have the latest copies of everything.
>
> I'm guessing there's a way to do this with rsync but I'm kind
> of stumped.
>
> Ideas?

Never tried it before, but I would think you could use the -u option to 
skip newer files, and do a push followed by a pull so that the newer 
files from each side get copied.  However you wouldn't be able to use 
the delete files option as new files could get deleted instead of 
copied, depending on which side ran first.

-- 
Thanks,
    Dean E. Weimer
    http://www.dweimer.net/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cdf3a6913ccdb206c80ed7a57965b3d4>