Quick one-liner using rsync to sync directories

I needed to synchronize a local documents directory on my MacBook with a remote share on a Windows server. Here’s one way to do that, using rsync from within the Mac OS X terminal window. Connect to your Windows share and then open a terminal window and do the following:

rsync -avz --stats --exclude "Microsoft User Data" 
~/Documents/ /Volumes/HOME/TARGETDIR/My Documents/

This synchronizes everything in my home Documents directory with a folder on the server. Obviously, you’ll need to substitute the proper directory name for “TARGETDIR” above. Note that I’ve exclued the local folder called “Microsoft User Data”. This avoids the unnecessary transfer of 1.x GB of Microsoft Entourage/Exchange database data. Let me know if you have questions about this. Remember you can always look up more information about rsync by doing man rsync at the command line. If you are trying out new rsync options, use the -n or --dry-run option. This will allow you to test out your command line without actually running the file copy.

Reblog this post [with Zemanta]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s