Transferring an iTunes Library from an Old PC to a New PC

New Nano

I was lighting up the internet last night with foul and obscene posts regarding Apple and Steve Jobs and iTunes’ general suckiness because of one thing: An inability to—inside iTunes—easily make the switch from one computer to another.

I eventually made it work, and this is documentation how. For people who found this via Google, let me specify the exact conditions I was working with:

Old PC

  • Windows XP
  • iTunes 9.0?
  • The iTunes library was not in the default location (i.e. c:\documents and settings\my username\my music\whateverthehellitunescallsthisdirectory). The media folder was in a separate (internal) hard drive specified as E:\Music
  • Home Network (i.e. didn’t have to mess with iPod transfers or external hard drives)

New PC

  • Dell Studio 16 XPS Laptop
  • New installation of iTunes
  • Defaults for directory settings1
  • Windows 7

Move the entire E:\Music directory from the Old PC to the New PC’s default iTunes directory while still maintaining my Library data (i.e. playcount, playlists, song rankings, etc.)

From the initial research that I was doing via Apple help (useless) and Google searches (a bit less useless) it seems that iTunes brands itself as the best music database manager evah yet can’t do what I would regard as a simple task, which is to pick up the database from another installation on the same home network and port it to a new location.

Difficulty Defined
You see, iTunes isn’t a media directory, it’s a media database and the important distinction is that you could have media files (mp3, wav, mp4, aac, videos, etc.) scattered all across your computer and iTunes, being a database, doesn’t care. It simply sticks the (for example) music file into your Library, with the correct labels and artist and album art and links internally to that particular spot on your hard drive. So, if you look at two adjacent songs on your iTunes library, it’s perfectly possible for one of them to be at C:\Music and the other to be at D:\Another Directory\On Another Disc\Deep in a Subdirectory but from the perspective of you using the iTunes Library, it doesn’t matter.

iTunes does this by keeping track, in its library file, where that internal directory reference for the music file is. And herein lies the rub: You can’t just copy all your music to another spot and keep the same Library because every single one of those internal reference links will break. So, in order to move your music from one computer to another, you have to insure that your library references either remain the same, or get changed to reflect the new locations. If you’d asked me yesterday, I’d have said that the new version of iTunes should be able to do this automatically, I mean it’s not like no one’s ever going to buy a new computer ever again, thank you very much Apple. Apparently, I would have been wrong.

My Solution
As specified above, my directory structure was changing once I was at the new computer so I had to make modifications to my Library in order to change the directory path of each media file. Then I copied over the entire Music directory from the previous computer and voila, it was fine.

This is the exact sequence of events I used, minus the crap that didn’t work

  1. Exported the Library file from the Old PC: iTunes menu File –> Library –> Export Library and I saved the exported file (an XML file) to my new computer. I was operating on a home network so this was easy.
  2. Downloaded and installed a trial copy of UltraEdit, an XML editor
  3. Did a Replace (under the Search menu of UltraEdit) of every instance of “E:/Music/” with “C:/Users/Bill/Music/”.
  4. Two Important Notes:

    • In windows, the directory path uses backslashes, like this “\”, however XML uses forward slashes, like this “/”. Make sure when you’re replacing the directory structure text that you’re using forward slashes. If you copy/paste the path from a windows explorer path bar, you’ll get backslashes.
    • Also, and I don’t know if this is critical but I didn’t want to find out the hard way, but the directory path in the XML Library file was “E:/Music/”. Note the very last slash. In the windows explorer path bar (suitably modified with slashes instead of backslashes) it was only “C:/Users/Bill/Music”. Note the absence of the last slash. When I did the replace in UltraEdit, I added the last slash onto the path so that I ended up with “C:/Music/Users/Bill/Music/”2
  5. Copied the entirety of my E:\Music directory on the Old PC to the C:\Users\Bill\Music directory on the New PC.
  6. Opened up iTunes and imported the library file I modified two steps ago. I’m sorry, did I say I imported the library? I meant to say that I imported the “playlist” because despite the fact that you can export libraries, iTunes doesn’t seem to think that it’s important to import them. However, you can import a playlist and choose the library and this apparently does the same thing. File –> Library –> Import Playlist and select the library file you just modified. This took me about 5 minutes to run.
  7. iTunes then did [stuff] and gave me a message that said it was unable to import some songs because it could not find them. A cursory look at the Library on the New PC seemed to indicate that whatever it couldn’t find wasn’t important (and wouldn’t it have been nice if it gave me a text file or something that listed exactly what it couldn’t find? yeah, it would have) so I decided to move ahead, clicked the “ok” button or whatever it was that was offered
  8. iTunes then proceeded to run through my entire library (took about 5 minutes) to verify the gaps of the songs? I’m not precisely sure what it was doing.

And now I have an iTunes Library on the new PC.

I haven’t yet run all the various features of iTunes yet, such as authorizing the new installation to use my password and the files that I downloaded eons ago (if I still have to do that?). If I run into any trouble that makes me scream for Jobs’ blood, I’ll let you know.

1: Many moons ago I learned/decided that it’s just so much easier to always go with the default directory settings that Windows and iTunes and other programs such as that specify. It makes upgrading and keeping track of things that much simpler.
2: This may or may not have been important. The majority of the paths that were being replace looked like this:
When the replace I describe above operates, it will replace the the last slash (after /Music/) with another slash; basically a wash in the operation. However, I do not know if there are any locations in that XML file that didn’t have anything after the /Music/ which would have ended up with /Music without the slash if I wasn’t careful. This was me being paranoid. I suppose I could have done a search for /Music/ without any further text string but I didn’t think about that until just now.

This entry was posted in Random. Bookmark the permalink.

3 Responses to Transferring an iTunes Library from an Old PC to a New PC

  1. annie says:

    That sounds only moderately more tedious than just importing all the music files to the new machine & then recreating play lists, and such.

    Of course, I generally don’t care about ratings, number of times played, etc. so this is what I did when I recently moved my iTunes library from my old machine (well, off the external hard drive copy of my old machine) to my new machine.

  2. Bill Ruhsam says:

    Some dude had a really good suggestion if all you wanted to do was to keep your ratings: Make five playlists that were 1 star, 2 star, 3 star, etc. for each of the songs that belong.

    After you’ve imported all your music, just upload your playlists and then select-all and pick the right number of stars.

    You lose your # of times played, though, plus I’d have no idea which podcast episodes I’ve listened to and which I have not.

  3. Pingback: The Evil Eyebrow » Office and Workflow Reorganization

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>