two way mirroring or syncing?

Matt Alexander plug-discuss@lists.plug.phoenix.az.us
Tue, 17 Dec 2002 19:58:26 -0800 (PST)


On Tue, 17 Dec 2002, Kurt Granroth wrote:

> Does anybody know of a tool that will keep two directories totally in sync
> but not in real-time?  Basically, I want to have two directories /A and /B
> that every time they are synced (maybe once an hour), they will be
> identical.  Changes can happen on either /A or /B.

Hmm...  so if /A/myfile is modified and then 5 minutes later, /B/myfile is
modified, which myfile would you choose to keep?  I think the only way to
go both ways is if you don't modify the same files in each directory.  In
which case, you could use rsync.

> Now rsync is great for one-way updates.  If, say, all changes are only done
> to /A than rsync is perfect for keeping /B in sync.  However, if you start
> deleting files, then rsync doesn't know what to keep and what to delete.

rsync can handle deleted files with the --delete option.  If /A/myfile was
deleted, then when you ran rsync going from /A to /B, then /B/myfile would
be removed.  Likewise for any files deleted from /B when going from /B to
/A.
~M