Using rsync to synchronize iTunes libraries
by Craig Ruksznis - April 2, 2008 / 5:24pm
As I was on my nth drag-and-drop transfer of my music collection on my work computer on to my external to bring home and listen to nights, it occurred to me that there may be a better solution. I had been deleting the music from my external and then transferring my entire collection to my external from my work computer: hello inefficiency. It dawned upon me to ask the developers about potential solutions, and thanks to help from Will and Jeff, I am now using rsync to keep my two collections synchronized.
rsync allows you to synchronize files from one directory to another. There are endless options, whether you want old files to be deleted, new files to be added, etc. The solution I found most effective for keeping my iTunes collection was run the following command:
rsync -av --delete ~/Music/iTunes/ /Volumes/External Drive/iTunes/
The first directory is the source directory, or where the music is coming from. The latter directory is the destination, or host, directory. The '-av' stands for two commands, 'a' and 'v'. The letter 'a' represents 'archive', which makes sure that all of the permissions in the new host directory (the latter of the two) recursively. 'v' stands for verbose, which outputs any action that is occurring so that I can keep tabs on the progress and check for errors. Adding the --delete ensures that any files I have deleted in the source directory will also be deleted in the host directory. Now to check to make sure that everything will transfer cleanly you can add '--dry-run' after '--delete'. I ran this first to check that everything will work correctly without actually moving any files.
Also, by synchronizing my entire iTunes folder I am able to synchronize the playlists, artwork, and iTunes preferences. When I run this music collection on another computer, I hold down the alt button while I start iTunes, and choose that iTunes folder. This will open up that library, not the library that it typically defaults to.
The first time this command runs it will copy everything over. Anytime it runs after that it performs the synchronization. Cheers —
3 Comments
http://homepage.mac.com/oligrob/syncOtunes/syncOtunes.html
Obviously rsync is a great option if you are willing to maintain a single master library but syncOtunes is the way to go if you want to try to keep ratings and other library settings to be the same across all your libraries.
@Errol - This is a good idea if you want to customize your sync in terms of iTunes playlists! Since I am interested in an exactly replica from one library to another, I prefer using rsync.