iTunes: Moving To A New Computer

[iTunes Version at the time of writing]

I’ve lost count of the number of times I’ve had to move all my files from one PC to another, either because I’m reinstalling Windows; I’ve purchased a new laptop, or any number of other reasons.

Keeping all your files, photos and music libraries intact has always been a bit of a challenge. Windows Vista makes things a little easier with a more Mac/Linux like approach to organising user’s files … but shifting all those files is still prone to error. The application that keeps tripping me up is iTunes, so I thought I’d share my tried and tested technique for keeping everything in order.

Obviously, if you’re new PC has the exact same directory stucture as the old PC, then chances are you can simply copy your entire Music or My Music folder, and everything will just work. However, if you’re moving from XP to Vista; to/from PC to Mac, or you’re using a different username, then you’ll need to read on.

WARNING: Before you perform any of these steps, make sure you deauthorize your iTunes account on your old PC! See here for more information …

There are a number of ways to move your entire iTunes library to a new PC. Lets have a look at them:

Technique 1 (Basic)

The easiest way is to simply copy your music files across, and then simply import them into iTunes on the new PC. This approach works just fine: all your music is intact, but you loose a lot of your original library data (playlists, playcounts, last played dates, etc). This may not be a problem if you have a small library, and dont rely on the functionality of Smart Playlists. However, many of us have huge collections of music, and have spent a lot of time organising them carefully.

Technique 2 (Tedious!)

iTunes has a built-in feature that helps you consolidate all your media files into the folder you’ve chosen to hold your music (typically /My Music/iTunes/iTunes Music ). The trick here is to use the feature to move your entire library to a folder at the root of the C: drive. Once moved, you can copy the files to your new PC and use the consolidate command again to move everything into the right place. This is quite time consuming, but if you’re not happy with the Technique 3, then here’s what you need to do:

  1. Open iTunes
  2. Open the advanced preferences (Edit -> Preferences -> Advanced (Tab) )
  3. Change the “iTunes Music folder location” to a new folder at the root of C: (e.g. “C:iTunes Music”)
  4. Make sure the “Keep iTunes Music Folder Organised” checkbox is checked.
  5. Click OK to close the preferences.
  6. Select “Consolidate Library…” from File -> Library.
  7. Once you click “Consolidate”, your iTunes music files will be moved to this new location … which will take some time!
  8. (Grab a beer and watch some TV)
  9. Once complete, you now need to copy the new folder across to your new PC. Make sure you place it in the same location.
  10. Then copy the iTunes Library.itl file from your music folder (“My Music/iTunes” on XP, “Music/iTunes” on Vista), and place it in a similar folder on the new PC.
  11. While holding down SHIFT, launch iTunes on the new PC.
  12. Select “Choose Library …” from the dialogue box, and locate the iTunes Library.itl file you just copied.
  13. Hopefully iTunes will now open with all your music intact. However, it’s not a good idea to leave your music folder at the root of the C: drive …
  14. Repeat steps 2 to 7 again, but set your “iTunes Music folder location” to something logical within your music folder. (e.g. /Music/iTunes/iTunes Music/).
  15. Relax. You’re done.

Personally, I find this method very tedious, as you’re needlessly copying files again and again.

Technique 3 (My favourite)

I got to thinking: there must be a simple way for me to explain to iTunes that all the music files are simply in a different folder. Turns out there’s a way, but it involves a bit of XML editing. Here’s what you need to do:

  1. Open iTunes.
  2. Consolidate the library (File -> Library -> Consolidate Library …). (This is just good practice. It shouldn’t take long.)
  3. Now export the library (File -> Library -> Export Library)
  4. Copy your entire iTunes music folder onto the new PC. (Typically “/My Music/iTunes/iTunes Music/” or “/Music/iTunes/iTunes Music/”)
  5. Copy the exported library .XML file to your new PC. (Anywhere will do, so long as you can find it again!)
  6. On the new PC, locate and open the .XML file in Wordpad. (or your favourite XML editor – but Wordpad is fast for our needs).
  7. Scroll down until you locate an element of XML that looks like this:<dict>
      <key>Track ID</key><integer>4009</integer>
      <key>Name</key><string>You Can Call Me Al</string>
      <key>Artist</key><string>Paul Simon</string>
      <key>Composer</key><string>Paul Simon</string>
      <key>Album</key><string>Negotiations And Love Songs 1971-1986</string>
      <key>Kind</key><string>MPEG audio file</string>
      <key>Total Time</key><integer>280398</integer>
      <key>Disc Number</key><integer>1</integer>
      <key>Disc Count</key><integer>1</integer>
      <key>Track Number</key><integer>16</integer>
      <key>Track Count</key><integer>16</integer>
      <key>Date Modified</key><date>2005-07-17T00:07:08Z</date>
      <key>Date Added</key><date>2009-01-11T02:09:20Z</date>
      <key>Bit Rate</key><integer>192</integer>
      <key>Sample Rate</key><integer>44100</integer>
      <key>Play Count</key><integer>11</integer>
      <key>Play Date</key><integer>3300611948</integer>
      <key>Play Date UTC</key><date>2008-08-03T12:39:08Z</date>
      <key>Album Rating</key><integer>100</integer>
      <key>Album Rating Computed</key><true/>
      <key>Artwork Count</key><integer>1</integer>
      <key>Persistent ID</key><string>89971E9CC8BE64CD</string>
      <key>Track Type</key><string>File</string>
        <string>file://localhost/C:/Users/Oli/Music/iTunes/iTunes Music/Negoti...20Me%20Al.mp3</string>
      <key>File Folder Count</key><integer>4</integer>
      <key>Library Folder Count</key><integer>1</integer>
  8. Locate the part I’ve highlighted in red (this path will differ from PC to PC).
  9. Using Wordpad, highlight that part of the path in your XML file and press CTRL-H to open the Find & Replace dialog.
  10. In the “Replace With” textbox, enter the new path for your music files. Make sure to use forward slashes “/”, not backward “” ones!
  11. Press the “Replace All” button, and wait a while.
  12. Once complete, Save and exit Wordpad.
  13. Open iTunes.
  14. Select “File -> Library -> Import Playlist…”, and choose to import the XML file we just edited. iTunes will spend a while importing the library.
  15. Once complete there’s a little tidying up to do, as you may find some duplicate playlists have been created, along with some static playlists for podcats, music, audiobooks, etc. Just go through and delete anything you dont want.
  16. That’s it!

Personally I prefer this third technique as it gives me complete control over the files. You just need to be careful when editing that XML file. I usually make a safety copy before I do any editing.

The only downside I’ve found to this approach (apart from the duplicate/extra playlists it creates) is if you’ve imported a lot of custom video to iTunes, and then manually changed their media type to “TV Shows”, you may find this process sets them back to “Movies”. If you have a lot of mixed TV Shows and Movies content, this could be a small headache. This problem doesn’t occur with any iTMS purchased content.

Finally, I’ve explained these steps with Windows XP or Vista specifically in mind. However, the same methods can be used on the Mac using Textedit. However, because of the way the Mac references files stored in the user’s home folder, you’ll probably never need to do this. Simply copy your files to your new Mac.

Please let me know if you have any better methods for moving your iTunes files.