iTunes added "file://localhost" to every song, and so cannot find my entire library

I have seen this question posted several times, but never with an answer. Hopefully somebody knows how to deal with this. Here is more info than you probably want to see:


I just swapped out the main hard drive (C: drive) on my Windows 7 PC. My music was on a different hard drive (M: drive), so it was not touched; but of course my iTunes library was on my C: drive, so I backed it up prior to starting. After putting all of my data files back where they belonged, I reinstalled iTunes and it found my library no problem. But it cannot find any of my media files on the M: drive. If you check the properties of any music file, it has prepended "file://localhost" to every single file name...for example:


file://localhost/M:/iTunes Media/Music/Aerosmith/Greatest Hits/01 Dream On.mp3


is somehow in there now, instead of what was in their prior to the move:


M:/iTunes Media/Music/Aerosmith/Greatest Hits/01 Dream On.mp3


I was still on iTunes 11 prior to this but had to download iTunes 12 during the reinstall, but I can't believe that is the cause.


So does anyone know how to bulk delete the "file://localhost/" from over 7000 songs in an iTunes library? The only article I have seen so far with an answer did not work for me (change the media folder location to something else in Preferences, then change it back)...

Windows 7

Posted on Jul 22, 2015 5:37 PM

Reply
3 replies

Jul 23, 2015 8:36 AM in response to MikeCarmack

Can you double-check the location of that track as seen via Windows Explorer? You've posted / instead of \ and there might be some other difference between the two paths that you've inadvertently omitted.




The "missing file" error happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, one of its parent folders, or the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout, or vice-versa, and so is looking in slightly the wrong place.


Select a track with an exclamation mark, use Ctrl-I to Get Info, then click No when asked to try to locate the track. (Due to a bug in iTunes 12 you currently have to say No twice!) Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, a folder renamed, or a drive letter has changed, it should be possible to reverse the actions. If the difference between the two paths is an additional Music folder in one path then this is a layout issue. I can explain further if that is the case.


In some cases iTunes may be able to repair itself if you go through the same steps with Get Info but this time click Locate and browse to the lost track. It may then offer to attempt to automatically fix other broken links. Although it says something like "use the same location" it expects to find the tracks in the same artist & album layout that it generates, not all in one big folder.


If another application like Windows Media Player has moved/renamed the files then the chances are that subtle differences in naming strategies will make it hard to restore the media to the precise path that iTunes is expecting. In such cases, as long as the missing files can be found somewhere, you should be able to use my FindTracks script to reconnect them to iTunes. See this post for an explanation of how it works.


If you want me to try to provide specific advice please post back the following details:

  1. The location of the media folder under Edit > Preferences > Advanced
  2. The location of a sample missing track shown under Get Info > File > Location that begins file://localhost/
  3. The true path to the file whose details you gave in 2.




See also Repair security permissions for iTunes for Windows.




tt2

Jul 23, 2015 4:12 PM in response to turingtest2

Pointing me to the FindTrack scripts helped me diagnose this, I think. I'll post my solution in case others still run into this issue.


To answer your questions first though, my files had not moved. Everything was in M:\iTunes Media before I reinstalled Windows, and it was all still in the exact same place afterwards. But inside iTunes, every one of my 7300+ songs (or so I presume, I only checked about 20) had been updated in the Get Info > File > Location screen to have the file://localhost/ prefix. And I hadn't noticed it until you pointed it out, but every backslash had been changed to a forward slash too. The first path I posted in my original post was a cut-and-paste from iTunes; the second one was, my bad, that same cut-and-paste with the prefix manually edited out. Had I done a *real* cut-and-paste from Windows, it would have shown backslashes.


Anyway, the solution: When I ran the FindTracks script, I kept getting permissions errors. Which made no sense, because the M:\iTunes Media folder had full permissions for all Users on the PC. But I did into the file system some more, and found that M:\iTunes Media\Music did NOT grant full permissions to all Users. Not sure why, it had a couple of invalid user entries presumably left over from my previous install...so I removed those, granted full access to all Users, and tried the script again. This time it worked...script said it was going to scan 8000+ files and it succeeded with no errors. But it said it only found and fixed ONE file, so I was concerned. But lo and behold, when I opened iTunes, all of my music was findable and played no problem!


So I believe that, when iTunes is blocked from reading the music directory due to permissions, it displays that localhost path as a "proxy" for the real path, which it no longer thinks exists. But if you correct the permissions issues, it can read the file location again and all is well. At least that's what I think happened.

Jul 23, 2015 4:35 PM in response to MikeCarmack

The leading file://localhost/ and reversed slashes is how iTunes represents the file paths internally. iTunes normally shows this form when it cannot confirm the file is present at the expected location. Not being able to read the file is, I guess, the same as it not being there from its perspective, but I hadn't realised that incorrect permissions would do this before so thank you for the update. 🙂


tt2

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

iTunes added "file://localhost" to every song, and so cannot find my entire library

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.