How to Use the rsync Command By Josh Blagden | JB - Mac Help | JBlagden

How to Use the rsync Command                        By Josh Blagden

Have you ever wanted to synchronize the files on your Mac and your flash drive? The rsync command is very useful for synchronizing files in two different locations. If you carry a flash drive with you, you likely have to synchronize files at least once in a while.  It’s certainly a lot easier to enter a command  than it is to find out which files need to be added to a flash drive and then copying them over. Admittedly, it usually takes 2-3 minutes, but it’s a lot easier than manually moving files over.

This is how the rsync command works:

 1. Open Terminal

2. Type (sans quotes): “rsync -v -r”

3. Drag the two folders you would like to synchronize into the Terminal window to get the file paths in the format Terminal requires. Your command should look something like this: rsync -v -r First/File/Path Second/File/Path

This is particularly useful for tasks like keeping Dropbox folders up-to-date. My favorite use for this command is keeping a couple of folders on my flash drive synchronized with my MacBook. 

You can either run the rsync command manually or you can use Automator to create a script which does this. To create an Automator script for this:

1. Open Automator

2. In the window which asks you to “Choose a type for your document”, select “Application”. Though, if you’re going to use this for a drive which will always be connected, you should choose “Calendar Alarm” instead so the script will run automatically on a regular basis which you specify. For example, you could have it run at 5 PM every day or at 2 PM every week.

3. In the menu on the left, click on “Terminal”. You should find an action called “Run shell script”. Drag that action to the area on the left

4. In the text box of the “Run shell script”, paste in the command from step 3 of the earlier set of instructions.

5. Save it in a place where you can find it if you need to. Make an alias of the script and copy it to the desktop. You could just keep the script on your desktop, but if you delete it when you’re clearing away unused items on your desktop, it’s much better to delete an alias than the original.

The rsync command is very useful for keeping folders on a Mac and an external drive or server synchronized wth very little effort. In older versions of OS X, you had to use something like ChronX to run the rsync command on a regular basis, but now you can use Calendar for that.

© Joshua Blagden & Justin Barczak 2013-2015
000webhost logo