rsync dir in _both_ directions?

Dave Dykstra dwd at
Wed Feb 6 03:35:19 EST 2002

On Mon, Feb 04, 2002 at 11:58:04AM -0600, Jack McKinney wrote:
>     I felt certain there was an option to do this, but I cannot find it.
> I want to rsync a directory on machine A over to machine B, and then rsync
> the directory on machine B back to machine A.
>     The idea is this:  I read my email using mutt, which is set to save my
> email in ~/Mail in maildir format.  This means that each message is in its
> own file, instead of being appended to an existing file.  Thus, if I backup
> my email by rsync'ing it to another machine, only the new messages are copied
> over.  Mailboxes need not be. Before you say that rsync only sends changed
> blocks, and the changed blocks are at the end if the message is appended,
> remember that mail readers write status into the headers of the messages.
> If I change the status on the first message in the box (reply to it, delete
> it), then the ENTIRE mailbox is re-copied.  Not so in maildir format.

Are you sure about that?  Rsync is able to locate identical blocks that
are in a different position.

>     Well, I read my email on my laptop, and it is sometimes necessary to
> login to a central server to read my email (firewall issues).  What I do is
> to peridocally sync with the central server (which we'll call "server") by:
> rsync -e ssh -rptlv Mail server:.
> rsync -e ssh -rptlv server:Mail .
>     I'd like to do this in one command.  Is there a switch to rsync that
> says to make the local and remote directories identical, even if that means
> transfering data in both directions?

No there isn't.  What's wrong with doing it in two commands?

You may be interested in

which is explicitly designed to sync mailboxes.

- Dave Dykstra

More information about the rsync mailing list