This morning when I hopped on my home desktop machine, I was greeted with a nice iTunes error message telling me that my iPod was trying to sync with a library other than the one it was registered with. Huh?? A quick look at iTunes revealed the problem - it was completely blank! No songs, no podcasts, nothing. That's odd, because I have close to 30k songs I've ripped. I had a good idea what was wrong (but not how/why it happened). A quick look in my "My Documents\My Music\iTunes" directory revealed the problem. Both my "iTunes Music Library.xml" and my "iTunes Library.itl" file were only a few bytes each - when each of them should have been close to 50MB.

To make matters worse, I'm obsessed with meta-data. I have all of the album art and ID3 data for every single song - which is OK because the album art is stored in the directory for each album, and most of the meta-data is in the ID3 tags. BUT, because iTunes insists on using ratings outside of the ID3 tag format, all of the rating information I had accumulated (and associated smart playlists) was gone.

To top things off, I hadn't bothered to make a backup of my iTunes Library XML file lately because I'm running low on storage space. No excuse, I know.

Luckily, while I was looking in the iTunes directory, I noticed a sub-directory called "Previous iTunes Libraries". Inside that dicrectory were several copies of my "iTunes Library.itl" file. The most current one was about three months old - probably the last time I upgraded iTunes. Best case scenario I was looking at here was getting my library back, minus about three months worth of meta-data.

Getting iTunes to use the old .itl file was easy:

  1. Close iTuned
  2. Delete the blank/corrupted "iTunes Music Library.xml" and "iTunes Library.itl" files from "My Documents\My Music\iTunes"
  3. Copy the backup "iTunes Library.itl" file from the "Previous iTunes Libraries" directory to "My Documents\My Music\iTunes"
  4. Open iTunes - all of your music and meta-data up to the point of the backup file will be back.
  5. You'll need to add any music that you've gotten since the update. For me, that was easy. I just choose Add Music from Folder from the iTunes menu and chose the root directory where all of my music is stored. In about 10 minutes, iTunes had added all of the missing songs back to my library

There you have it. Relatively easy way to recover a deleted or corrupted iTunes library. Now if only I knew why iTunes decided to wipe it out in the first place.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Bruno's Gravatar Thanks soo much for this post !!! It's the second time this exact same problem appends to me !!! I did the same as you and now works fine !! :)
I don't have a clue why itunes does that... it has been doing that to me two times since I've upgraded to VISTA and put my itunes library on my portable 500Gig HD . I have a feeling one of them is responsable for this... Did you found out the cause of this ??
# Posted By Bruno | 1/8/08 7:51 PM
Rob Brooks-Bilson's Gravatar Hi Bruno,

I'm glad you found this post helpful. So far, it's only happened to me once, and unfortunately, I still haven't found out what caused it. If you ever do find out, though, let me know.
# Posted By Rob Brooks-Bilson | 1/9/08 5:35 PM
petter smith's Gravatar Thanks for such a good suggestion because such a situation also appends to me and this article helps me .No i have no clue why itunes does that.

Petter Smith
# Posted By petter smith | 2/2/08 1:48 AM
Rachel Cunningham's Gravatar Thanks so much for this post! I opened iTunes this morning and it was empty... and I nearly had a heart attack. Although I did lose some playlists I created in the last couple of weeks, it wasn't nearly as bad as my entire library!

Thanks again,
Rachel.
# Posted By Rachel Cunningham | 2/10/08 12:28 PM
Nancy Sell's Gravatar THANKS! This fixed my iTunes. As with everyone else, don't know what caused it.
# Posted By Nancy Sell | 4/9/08 11:45 PM
John's Gravatar This just happened to me as well, but somehow my other previous libraries were corrupted as well. Everything has stayed the same on my iPod but I haven't allowed to it sync yet. Is there any way to access the library file on the iPod and put it on my pc?
# Posted By John | 6/20/08 2:03 AM
sarah's Gravatar Thank you sooooooooo much, thought that life as I know it was over. but all was not lost!
# Posted By sarah | 9/21/08 1:21 PM
philip's Gravatar thanks for this. i have read elsewhere that files can become corrupted if itunes is shut down during one of it's routines.
# Posted By philip | 9/23/08 11:51 AM
cdelbovo's Gravatar I had a similar issue and tried just removing"(Damaged)" from the DB filename. so far everything is exactly as it was before, with much less work. Hopefully this will work for most people, before switching to a previous DB or letting the xml rebuild.
# Posted By cdelbovo | 9/24/08 9:19 AM
Judith Mahoney's Gravatar Hi my computer won't allow me to delete the corrupted file. I created a backup, uninstalled, reinstalled iTunes 8 populated the new library and still the same issue. Each time I go into iTunes and exit it creates a temp file
two to be exact.
# Posted By Judith Mahoney | 9/29/08 11:35 AM
ian's Gravatar thanks so much, most of my playlist i use are built on playcounts, i've had this itunes for over a year now so its quite finely tuned to what i like. starting over would have been so annoying
# Posted By ian | 10/14/08 8:08 AM
Bel's Gravatar Thank-you v much for your post. I also nearly died when the same problem happened to me (on my Mac!!!) Anyway your solution worked on a mac also, however it appears that most of the artwork has gone MIA. Looks like I will have to download again :o(

Thanks again!
# Posted By Bel | 10/21/08 7:05 AM
J's Gravatar T-H-A-N-K
Y-O-U

you have no idea how this helped me. Years and years of inserting data into my library were lost in a stupid mistake.

Now i only lost 2 weeks from the last backup to today. Huge help.
# Posted By J | 10/24/08 8:03 PM
sarah's Gravatar Does anyone know how to get back playlists that were deleted from itunes on windows? my program suddenly deleted all my songs and playlists and i have over 35000 songs in my itunes and it took forever to put them all into files! can anyone help?
# Posted By sarah | 12/7/08 8:22 PM
Rob Brooks-Bilson's Gravatar Unfortunately, I'm not aware of any way to recover a playlist once it's been deleted. If you have a backup of your library file, it might still be in there.
# Posted By Rob Brooks-Bilson | 3/16/09 11:26 AM
Chip's Gravatar Thank you very much for this info... you saved me a lot of grief. I have over 2,000 albums and 50 playlists that suddenly disappeared, and this really helped a lot.
# Posted By Chip | 4/30/09 7:31 PM
Andy's Gravatar I'm a noob that is trying to retrieve tunes. My question is where were you looking that you saw "previous itunes libraries"? Were you looking in your program files, on your ipod? If you could tell me more specifically where to look I would appreciate it greatly.

Thanks.

Andy
# Posted By Andy | 9/6/09 6:15 PM
Rob Brooks-Bilson's Gravatar Hi Andy,

The additional copies of the xml library were in this directory on the computer running iTunes:

\My Documents\My Music\iTunes\Previous iTunes Libraries

Hope that helps

-Rob
# Posted By Rob Brooks-Bilson | 9/8/09 12:25 PM
Candace Wilson's Gravatar Thank you so much for the help! My husband's iTunes library became corrupted and we could not figure out how to fix it. Your solution saved us a ot of headache!!! Thank you!
# Posted By Candace Wilson | 5/22/10 5:02 PM



Copyright 1995-2010 Rob Brooks-Bilson. All rights reserved.
Aura skin for Raymond Camden's BlogCFC inspired by Joe Rinehart & Steven Erat. This blog is running version 5.9.004.