Recipe: Synchronize music folder to an external device

This is easy to come up with, but as I end up having to dig through rsync‘s manual page to find the relevant options to copy my music to a device that has a non-Unix filesystem, it may be good to just write the recipe down here. Note that I am assuming that the file system in the device does not permission bits and ownerships (e.g. FAT), so those are not to be kept, and using rsync --archive is not a good option rsync will fail to set those extra attributes.

rsync --progress --delete -vrtxmhi ~/Music/ /media/${target_device}/Music/

This is what I use to keep my music library synchronized across my laptop, my phones and the extra backup in an external hard drive :-)

Tags: , , , ,

2 comments

  1. This post is IMHO a clear example of the two main reasons why the iPod became a huge success since its conception:

    1. People need to syncrhonize their music across devices.
    2. Synchronizing stuff is not a trivial thing to most users.

    Anyway, thanks for the recipe. As one of those weird people out there using, like you, rsync for synchronizing devices, I appreciate it, specially the ‘–vrtxmhi’ part. :-)

    • You are right, for people that does not care about how things do work under the hood, back when the iPod appeared, it made it easy for most people to keep their MP3 players in sync (well, actually the sync was implemented in iTunes). One thing that I never liked about it is having to rely on an application (iTunes) that works only in “certain” operating systems. There is another fact that confirms that file sync should Just Work™: the success of DropBox.

      At some point I even had some fun making a script that allowed to just use cp or rsync to copy the music: it would mangle the paths stored in the database used by the iPod to trick it into recognizing the audio files…

      There is one feature I have missed in rsync a couple of times: two-way synchronization. Most of the time it is possible to live without it, or to launch rsync twice with the proper options to simulate it… But at some point I will be trying Unison, which was pointed out by a friend not long ago :D

Leave a comment


Bad Behavior has blocked 258 access attempts in the last 7 days.