How to get the missing file location for a track

Ok, so the title might seem to be an oxymoron, but the 'Get Info' box shows a 'Where:' for both present

and missing files


so is it programmatically possible to extract the missing file path shown from the IITTrack's '.location' or similar?

For background: iTunes regularly loses files in Windows (and, I believe, Macs), but I regularly back-up my entire library once I have checked for lost files. If I do find any lost files, then I recover them by hand, but it would be nice to take the drudgery out of this.



Posted on Sep 16, 2025 2:46 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 16, 2025 3:30 AM

Although iTunes "knows" where missing files are supposed to be, it usually returns an empty string via the scripting interface if you ask for the location of file that isn't there. Here is my boilerplate post on fixing broken links. The FindTracks script predicts the actual location from known properties and can do some fuzzy matching searches among a set of possible alternate locations.




The "missing file" issue with exclamation marks 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, or you've moved a non-portable library to a different path (see Make a split library portable for details). 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, or that you've been too aggressive when deleting duplicates. See Getting iTunes & Windows Media Player to play nicely if you're trying to access your media with any other media players.


Select a track with an exclamation mark, use Ctrl-I to Get Info, then click No when asked to try to locate the track. Look on the file 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. If everything is where it is supposed to be try Repair security permissions for iTunes for Windows.


In some cases iTunes may be able to repair itself if you go through the same steps with Get Info, or when playing a track, 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" I think it expects to find the tracks in the same artist & album layout they were in previously, with one systematic change to the path.


If another application like Windows Media Player has moved/renamed the files, or the library has been moved from OS X to Windows, 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. It might need some tweaking if your media is in a non-standard layout.


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


Note the addition of file://localhost/ (and the flipped direction of slashes in Windows) is normal for a file that isn't quite where iTunes is expecting to find it.


tt2

5 replies
Question marked as Top-ranking reply

Sep 16, 2025 3:30 AM in response to TheSplund

Although iTunes "knows" where missing files are supposed to be, it usually returns an empty string via the scripting interface if you ask for the location of file that isn't there. Here is my boilerplate post on fixing broken links. The FindTracks script predicts the actual location from known properties and can do some fuzzy matching searches among a set of possible alternate locations.




The "missing file" issue with exclamation marks 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, or you've moved a non-portable library to a different path (see Make a split library portable for details). 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, or that you've been too aggressive when deleting duplicates. See Getting iTunes & Windows Media Player to play nicely if you're trying to access your media with any other media players.


Select a track with an exclamation mark, use Ctrl-I to Get Info, then click No when asked to try to locate the track. Look on the file 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. If everything is where it is supposed to be try Repair security permissions for iTunes for Windows.


In some cases iTunes may be able to repair itself if you go through the same steps with Get Info, or when playing a track, 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" I think it expects to find the tracks in the same artist & album layout they were in previously, with one systematic change to the path.


If another application like Windows Media Player has moved/renamed the files, or the library has been moved from OS X to Windows, 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. It might need some tweaking if your media is in a non-standard layout.


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


Note the addition of file://localhost/ (and the flipped direction of slashes in Windows) is normal for a file that isn't quite where iTunes is expecting to find it.


tt2

Sep 17, 2025 9:16 AM in response to TheSplund

Yep, the script is designed to help when files aren't where they are supposed/used to be but are still somewhere in the media folder, not to recover things that have actually been deleted. Time to root around in your backups. It is a little old now, but I still rely on SyncToy to manage folder synchronization. It can help reveal if something goes unexpectedly missing from a source folder, and can potentially be used to sensibly merge two alternate versions of the same media folder with minimal copying/overwriting.


To assess the scope of your issue with deleted files you might try this approach:


Lost & Found Playlists

Create a playlist called Found, select everything in the Songs view (Ctrl+A) and drag it into the Found playlist. Create a smart playlist called Lost with the rule Playlist is not Found and matching with Music items. Your lost tracks will be in this playlist.



tt2

Sep 17, 2025 6:39 AM in response to turingtest2

WMP is disabled, and I'd done 'Repair security permissions for iTunes for Windows' already. nb this seems to happen only when synching to an iPod, so I've restored the iPod (a 2012 model Classic with 2.0.5 firmware).

I keep all my music on a dedicated, internal, drive "M:\Music\Music". It's happened again with a few more - here's one that I've never seen get deleted:

file://localhost/M:/Music/Music/Max Webster/Max Webster/06 Coming Off the Moon.mp3

and it should reside in this folder:

M:\Music\Music\Max Webster\Max Webster

but iTunes has totally wiped it. There's nothing in the Recycle bin, and even a program such as 'Recuva' fails to find any trace of it (even though it found several thousand deleted files) and it's been a long time since I've tried peeking at the raw drive data inside the FAT to attempt a deeper dive!


Whilst rather neat, the FindTracks (and FindFiles) do not seem appropriate scripts, as they do not appear to be able to magically locate a deleted file. My alternative was to hunt my backup with a simple script. As you've confirmed my suspicion that this is a non-starter, then I may try FreeFileSync, or Comodo backup, and do a restore of missing files that way, at least I can see what's being restored for safety.

Sep 17, 2025 3:29 PM in response to turingtest2

I shall check out SyncToy- thanks.

Re 'Lost & Found Playlists': I've been doing that for quite some time now, and I had been hoping to use the 'Lost' (or 'Missing' in my case) as a basis for a script to run on - ah well.

However, I have one interesting little observation, that I guess I'd 'seen', but not really taken note of: the files being deleted from my PC have always been MP3s. This has just come back to mind whilst looking at the files that are currently being re-synched to my freshly restored iPod Classic, as interestingly, in the F01, F02,... folders on the iPod, all the MP3s appear to have 4 random letters substituting the original filename (something that I'd noticed some years ago), whereas the M4As seem to be the same as the filenames on my PC. A niggling feeling has me considering if any corruption on the iPod, and subsequent confusion with the resyncing of renamed MP3s, might just be playing a part in this process of deletion - but that's a rabbit hole I'm going to stop myself going down!

(footnote: a 'cautious' test of a sync to copy back just the missing files from my back-up has worked perfectly)

Thanks again.

(another footnote: there are some M4As that have been given a random 4 character name - oh well, bang goes part of that theory! :D )

Sep 17, 2025 4:15 PM in response to TheSplund

All the files copied to the iPod by iTunes are placed in a set of hidden folders on the device with those apparently random 4 character file names. If you're seeing anything in the F## folders with its original filename that would be very unusual and probably not a good sign.


As long as files are properly tagged (not .wav) then it is possible to copy them out of the iPod, unhide them, and drop them into an iTunes library which can rename and reorganize them properly again. I do have a script that can, all being well, recreate missing metadata for .wav tracks, or tracks that had their tags stipped during syncing, which can happen if you use an option to downsample to reduce storage space. Others can pull in playlists and stats.


Glad to hear restoring from your backup has helped.


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.

How to get the missing file location for a track

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