Darrin Ward Blog

One-Way Folder Syncing: Mac to Blackberry Folder Sync

August 27 2009, 5:55pm in Random Stuff

I use a BlackBerry 8820. I've got an iPhone, used to have a Sony Experia X1 (Windows Mobile) and I have tried a plethora of other phones (including other BlackBerry's), but the BlackBerry 8820 is the one for me.

However, one thing that used to irritate me about the phone was that it wasn't very easy to sync my iTunes music podcasts and some business documents from my Mac to the SD card in my BlackBerry. So I wrote a simple shell script that takes care of those things for me. The script I show here should also work with other BlackBerry's.

The script uses rsync to overwrite folders on my BlackBerry with folders on my Mac (like my iTunes folder). I saved the following code into a file named bb-sync.sh in my ~/ folder:

rsync -u -v -I -r --delete "/Users/DWard/Music/iTunes/iTunes Music/Podcasts/" "/Volumes/BB/iTunes/Podcasts/" &&
rsync -u -v -I -r --delete "/Users/DWard/Desktop/WalkMusic/" "/Volumes/BB/iTunes/Music/" &&
rsync -u -v -I -r --delete "/Users/DWard/Documents/Passwords.kdb" "/Volumes/BB/Documents/Passwords.kdb"

The formatting of the above code may look weird owing to linebreaks, so you can also Download bb-sync.sh.

This is 3 separate rsync commands because I am syncing 3 folders. On each line, the first reference to a file or folder is local on my mac and overwrites the second stated file/folder, which is on my BlackBerry SD card (they all start with "/Volumes/BB/").

My blackberry SD card mounts as a volume named "BB". Yours will probably mount as something else, but you can check by using "cd /Volumes/" in Terminal when your device is connected to see what name it uses when it mounts. You may need to plug it in and out to see the differences between mounted/unmounted states. The Volume name will probably also show up on the OS X Desktop as a drive when your BlackBerry SD card mounts. Substitute BB for the name of your BlackBerry SD card volume and change the directories that you want to sync.

When my BlackBerry SD card mounts, I sync by opening up terminal and typing "sh bb-sync.sh" and it prints out a report of the files it's deleting and new files it's uploading.

There are two last things that I will say: 1) That this technique will work for any mounted volume; it's not specific to BlackBerry, and; 2) You can fiddle with the rsync flags and options to get a two way sync, or some other functionality. But I'm not going to bother with that. See the man page for rsync if you want to do something other than what I have described here.

Now if you'll excuse me... I am going to listen to some recently synced podcasts on my BlackBerry while I go for my evening walk. :)

« Blog Homepage
« Random Stuff

Reader Comments:

There are no comments, yet! Why not be the first?

Submit Your Comment:

Name:
Email: (Not publicy displayed)
Website: Optional
Comment:
Contact / Submit RFP
Latest Blog Posts
© Copyright Darrin Ward / De Ward Group, LLC. - All Rights Reserved | Website Design by LinkShape