How to fix you iTunes library when moving the music files

Computer Crashed :(

Recently my old computer that I was running iTunes on gave up the ghost. IT was running RAMBUS memory and the memory decided its day had come. So I could not get into my old machine where all my music is. Since there is some legal issue around downloading music from iTunes in South Africa, I have relied on ripping CD to the iTunes library.

ITunes Gift CardThinking I was clever that I could save time doing this all again (I have over 500 CD's, a collection started in 1985). I decided that since the hard drive in my old machine was still okay I would get an external chassis and lace the drive in there.

Loaded new goodies

After the experience of the crashed drive I also bought a new external drive so that my music library would be portable. I copied the music folder to a new folder called music in the root of the new external drive.

Then I loaded iTunes onto the new machine. I set the iTunes folder to the new folder on the new external drive and the library imported fine. Fine that is until I noticed that my ratings and my groupings, and my playlists where all gone.

After a quick internet search I found these informative articles

Transferring your iTunes Library from iLounge
HOWTO: Move your itunes musicwhile preserving library data

Restoring my iTunes rating and groupings

I am running Vista (by Windows 7 works the same), after some digging I found a new iTunes folder in c:\users\%USERNAME%\Music (replace with your username) . I then found my old iTunes folder on the old machine (I was running XP, so it was in the old My Documents\My Music folder).

I copied all the files (although I now know you just need the "iTunes Music Library.xml" file. In windows explorer it will just list as "iTunes Music Library" but if you hover you mouse over it, it will say XML document.

Now here is the trick. If you have change the folder path that you have the music, then you need to edit the path in the XML file. In my case the path had changed from C:\My Documents/My Music to e:\Music

NOTE: In the XML file a space is represented as %20 (which means ASCII character 20 hex, or 32 decimal)

Make sure iTunes is closed when you do this.

  • Opened the file in notepad (you can use anything that is a text editor). Make a backup first if you do not have one.
  • Edit->Repalce (or find and replace) 
  • In Find text box: Enter "C:/My%20Documents/My%20Music"  - for me that was the correct path, if you scroll down the iTunes folder you will find your correct one. Notice the forward slash not the traditional backslash.
  • In Replace Enter E:/Music
  • Click on replace all, this will take a little while
  • Save the file
  • Re-open iTunes and all should be as it was
You may need to check the top line "Music Folder" it may change but check that it points to where the XML file is.

Note:

If you have already import you music into the Let you iTunes folder to E:\Music, and then import your music. The XML file should then link the to settings.

You may also need to delete and recreate the iTunes "iTunes Library.itl" file, do do this rename it to _*.* then create a file in notpad, and save it as "iTunes Library.itl" and set file type to all files.

Or in DOS prompt go the iTunes folder and do:
ren "iTunes Library.itl" _*.*
copy con iTunes Library.itl

press Ctrl+Z
This will create a blank file.

Then when you iTunes it will recreate the library

Update:
Still struggling with the merge of iTunes XML, so needed some reference of what tags are in the iTunes XML, and found it here:
Easily Parse iTunes Library XML

I am writing a merging tool, to do the merge, will keep you posted on this, if it works and if I finish it I will post on some freeware site, that does not charge

Latest Update 2 Feb 2011 After getting stuck on the XML merge I looked around and eventualy forked out to purchase CopyTrans which worked with pulling my ratings, grouping and other stuff I had stored. What I did was:
  • backed up all my music files, then;
  • go into iTunes, and click music, then
  • Edti->Select all;
  • select delete to delete them all
  • when finished (I suggest you erase the files too, so this can take a while
  • go to CopyTrans, and then selected all, and then backup
  • When it is finished you can go to iTunes and the files and settings there

I did try a few free tools but they did not copy the ratings, if you want to just copy from iPod to iTunes then SharePod works.

Comments