How to sync two iTunes folders

This assumes you have an “old” music folder at /path/to/old/dir and a “new” folder at /path/to/new/dir.

NOTE: iTunes has two options under preferences/advanced.  Either of these may make these instructions not work properly.  I’m not saying you should turn them off, but these instructions may not work if they’re on.
“Keep iTunes Music Folder organized” renames files and directories
“Copy to iTunes Music Folder” does that.

(optional) Tag your old music
You may also wish to open your existing library and change the grouping to your name.  (this will wipe out existing groupings; it’s not a field that seems to be used much – though you might want to check this first before wiping it out).  Note that some of the track fields (rating) are saved in iTunes Metadata (the library you created); others (name, artist, grouping, comments) are saved in the file itself.  We want to change a field that is in the file.
1. Open iTunes.
2. Select Library/Music.  Select all items (command-a).  Get Info (command-i).
3. Change the Grouping to the name of the new library, for example “old”.

Create a new iTunes library, and add the “new” mp3s to it.
1. Close iTunes.
2. Hold down option key.  Open iTunes.  (This will prompt you to create or choose library.  This works for iPhoto, too!)
3. Create library.  This will be a temporary library for the “new” folder.
4. File/Add to Library.  Choose the “new” folder.  This will take a while.
5. Select Library/Music.  Select all items (command-a).  Get Info (command-i).
6. Change the Grouping to the name of the new library, for example “new”.
7. Click OK.  This will take a while, since it has to save all files.
8. Quit iTunes.

Rsync the files
NOTE: if you use “Keep iTunes Folder Organized” you don’t need to do this step.
1. Open terminal.  The easiest way is to use spotlight – the magnifying glass in the upper right on your menu bar.  Type in Terminal and the first item to show up should be the terminal.
2. Use rysnc to synchronize the two libraries.
rsync -vaz /path/to/new/dir/ /path/to/old/dir/
Note that you MUST use the trailing slash as shown.  This should copy all new files from the new dir to the old dir, leaving existing files there.

Re-import files to your itunes library.
1. Hold down option key.  Open iTunes.  (This will prompt you to create or choose library.)
2. Choose your old library.
3. File/Add to Library.  Choose the “new” folder.  This will take a while.

Cleanup
When you’re happy it worked:
1. Delete the /path/to/new/dir/ directory.
2. Delete the new iTunes library.

Leave a Reply

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