Synch two directories with rsync

If you’ve ever thought, “What’s the easiest why to quickly synch two remote directories?”

If I were going to sync up two remote directories I would do this.

rsync -avz .

If I ran this command in a directory called Maildir.backup, all of the contents of the remote Maildir would be in there.

If I ran this command instead.

rsync -avz .

Noting the lack of a trailing slash on the source directory, in this case a Maildir directory would be created, if it didn’t already exist.

Sometimes I use rsync when I’m migrating servers. I’ll do an initial rsync of the old server applications to the new server. That will allow me to test out all of the applications to make sure I didn’t miss anything. Once I’m satisfied with the new server, I’ll run rsync again and pull down any changes that may have happened on the old server so that the two servers are totally synched before flipping the switch.

It’s also super handy for backing up directories.

Share Button