Tuesday, November 11, 2008

iTunes "The song could not be used because the original file could not be found. Would you like to locate it?" Fix

Because I wanted to upgrade to SP1 on my Vista x64 PC and was having problems doing the normal upgrade, I had to wipe out the drive and re-install from scratch. That was several months ago and since then I haven't sync'ed my iPod touch because I haven't installed iTunes. So finally today I decided to spend the time and do it. After I installed the newest version of iTunes and plugged in my iPod to the computer via USB, I got the message:

"The iPod is synced with another iTunes library. Do you want to erase this iPod and sync with this iTunes library?"

Now I had made a backup of my original user folder on my old Vista install. So I proceeded to shutdown iTunes, rename the folder:

C:\Users\MY_USER_NAME\Music\iTunes

to

C:\Users\MY_USER_NAME\Music\iTunes_bak
as backup.

Then I copied the backup iTunes folder with the xml file inside to C:\Users\MY_USER_NAME\Music\.

Upon launching iTunes again I was pleased to see the iPod being synced. But when I tried to click on a song to play it in iTunes I got the error message:

"The song could not be used because the original file could not be found. Would you like to locate it?"

This is because I had moved the mp3 folder to another hard drive since my new Vista install. I didn't want to manually go through all the songs and re-locate them within iTunes. So I took a look at the "iTunes Music Library.xml" file under C:\Users\MY_USER_NAME\Music\iTunes and noticed that the drive letter for each song were coded inside the file.

So I made a backup of the xml file, then opened it under notepad, and did a search and replace for "OLD_DRIVE_LETTER:/" to "NEW_DRIVE_LETTER:/" and saved the file. I ran iTunes but it actually rebuilds the xml file, apparently from "iTunes Library.itl". So this time I renamed "iTunes Library.itl" to "iTunes Library.itl.bak" as backup, and then created a blank text file when I then renamed to "iTunes Library.itl". And then I did the search and replace again, this time saving the file as "iTunes Music Library.xml.good".

Upon launching iTunes it gave a message that the library file is damaged and renamed to "iTunes Library (Damaged).itl". The music libary is shown as blank. I then went to File, Library, Import Playlist, and selected the "iTunes Music Library.xml.good" file. And aftering importing, voila!, everything worked like a charm!

Hope this help those of you out there running iTunes on Windows and have recently physically moved your music/mp3 folder. And be sure to backup your iTunes libary just in case- don't move your original iTunes libary folder but instead make a copy it.

6 comments:

Anonymous said...

Re-creating the iTunes Library file
Follow these steps:

Quit iTunes.
Locate your iTunes folder.
For Mac OS X the iTunes folder is stored in one of the following locations:
/Users/[your username]/Music
For Microsoft Windows XP and 2000 the iTunes folder is stored in:
\Documents and Settings\[your username]\My Documents\My Music\
For Microsoft Windows Vista the iTunes folder is stored in:
\Users\[your username]\Music\
Open your iTunes folder.
Drag the iTunes Music Library.xml to the Desktop
Drag the following file from your iTunes folder to the Trash:

Mac OS X: "iTunes Library" (in versions of iTunes prior to 4.9 this was called "iTunes 4 Music Library")
Microsoft Windows: "iTunes Library.itl" (in versions of iTunes prior to 4.9 this was called "iTunes 4 Music Library.itl")
Open iTunes.
From the File menu, choose Library > Import Playlist.
Tip: Do not add any music into iTunes at this point.

Navigate to the iTunes Music Library.xml file on the Desktop.
Mac users: Click Choose.
Windows users: Click Open.
After re-creating your library, any devices that you sync with iTunes (Apple TV, iPod, etc) will see your iTunes library as a new library and will completely resync."

For steps to backup and restore playlists see "iTunes: How to backup and restore playlists. "

If your podcasts list in iTunes is empty after following these steps, see article HT2562.

If the iTunes Music Library.xml file is not available, follow the "Add to library" steps in "iTunes: About the Add to Library, Import, and Convert functions" to add files back to the Library (because the iTunes Music Library.xml file is not available, playlists and other information will not be available).

Erik said...

Thank you very much for this post! I had this problem and knew it must be possible to fix it without losing information (or telling iTunes where to find each song one at a time). Your solution worked like a charm, and nothing I had found in my previous searches had helped.

alan said...

mmmm not sure how to resolve this as seemed to have tried most things now.

Basically i have over 5000 missing file locations showing in itunes though the files are actually there. I think my external hard drive somehow went offline whilst itunes was open and even though the file are there itunes wants me to click on each one to point it back to the location... this seems mad when all files exist in the correct path still, i would have thought that Apple-Itunes would have come up with a fix for these missing links by now as it seems a common issue judging by the amount of posts on various sites.

There doesnt seem to be one simple solution out there though.

I have over 10,0000 songs, half of them now have the explanation mark even though the files are NOT missing. I cannot click on each one individually and i dont want to loose all my play counts, last played, ratings etc by adding the music folders from scratch again.

If anyone can point me to a fix for this simple issue i would really appreciate it.

alan said...

mmmm not sure how to resolve this as seemed to have tried most things now.

Basically i have over 5000 missing file locations showing in itunes though the files are actually there. I think my external hard drive somehow went offline whilst itunes was open and even though the file are there itunes wants me to click on each one to point it back to the location... this seems mad when all files exist in the correct path still, i would have thought that Apple-Itunes would have come up with a fix for these missing links by now as it seems a common issue judging by the amount of posts on various sites.

There doesnt seem to be one simple solution out there though.

I have over 10,0000 songs, half of them now have the explanation mark even though the files are NOT missing. I cannot click on each one individually and i dont want to loose all my play counts, last played, ratings etc by adding the music folders from scratch again.

If anyone can point me to a fix for this simple issue i would really appreciate it.

barron said...

I'm wondering if Dave ever got an answer. I'm having exactly the same problem - the files are located on a Linux machine that is mounted as y: on the Windows machine. iTunes doesn't seem to have a way to rebuild its index.

R.J. said...

After searching for ways to transfer my iTunes library from my old laptop to my external drive, then my new laptop, this helped a lot. Thanks so much for the tip! Now all of my mp3s have the right paths and none are missing links.