Syncing your Music Library to an Android Phone – Wired

My most recent geeky purchase has been to cast away my now 2 year old IPhone 3GS for a spanking new Android-based Samsung Galaxy S2. So far, I’m very impressed!

One particular pain point though in moving from an iTunes based system, which handled the syncing of content seamlessly (when it didn’t crash), to an Android-based system which isn’t as user-friendly. I know the s2 ships with the Kies software but, from what I’ve read, it isn’t compatible with 64-bit Windows 7 and is a little bit crappy/bloated.

I’ve already posted about using rSync to automate backups amongst home systems and applied the same tool to keeping my Music library in sync.

You’ll need to disable the Kies piece on the phone in order to access the SD card via the file system by enabling USB Storage in the option: “Settings –> Applications –> Development –> USB Debugging”.

Plug the USB cable in, go to the status page and click the button saying “mount the USB storage”.

The script is simple and a 1 liner:

On Linux: rsync -av –delete –force –modify-window=5 “/path/to/music/” “/path/to/sdcard/Music/”

On Windows: rsync -av –delete –force –modify-window=5 “/cygdrive/DRIVE_LETTER/path/to/music/” “/cygdrive/DRIVE_LETTER/path/to/sdcard/Music/”

The options are: –

  • -a: Archive (this is the same as -rlptgoD)
  • -v: Verbose
  • –delete: This will ensure that the source destination is the master, deleting anything from the phone that isn’t on your main machine
  • –force: Force deletion of directories even if not empty
  • –modify-window=5: This will allow a 5 second difference in timestamps from source to destination before a file is flagged as “changed”.

Execute the script and all your files will be pushed to the SD card, the next time you run it, only modified/deleted files on the source machine will be moved/deleted.

Leave a Reply

Your email address will not be published. Required fields are marked *