Benjamin R Haskell dovecot@benizi.com writes:
[...]
An example of syncing 2 directories over ssh, keeping all permissions intact. This command run on the source maildir server.
rsync -av -e"ssh" /source_maildirs/ username@hostname:/destination/maildirs/
Couple tips (not criticisms): Nowadays, ssh is the default (unless compiled otherwise). So, the '-e"ssh"' is likely unneccessary. As is the 'username@' part, if the username is the same.
... Or if it's different, but one took care to provide an entry
in ~/.ssh/config, like:
$ cat ~/.ssh/config ...
Host alias remote.host HostName remote.host User remote.user
... $
And something to watch out for as a new rsync user:
The trailing slash is important on the source path. From the rsync 'man' page (read it!): A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination.
To put it short, SRC-DIR refers to a directory, and SRC-DIR/ --
to its contents.
> (But, it doesn't do anything on the destination path.)
That'd shorten the command to:
rsync -av /source_maildirs/ hostname:/destination/maildirs