itunes cannot find files

iTunes suddenly cannot find any of my music or videos. I was cleaning up my drives and did not delete *anything* that was labeled as an iTunes or library file, but all my videos (and there are many) and music (and there is a lot) is no longer in the library (the names are there but it says the files cannot be located. I *did not move them. This will take days to restore if I have to do it manually. Is there any other way?

Posted on Jul 2, 2018 7:38 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 5, 2018 8:04 AM

There are three main approaches you can take when there are missing links in the library. You can try to move the files to where iTunes thinks they should be, you can try to use a script to predict where the file is and if found tell iTunes the new location, or you can import the files from their new locations and then deduplicate, discarding the items with the broken links. Some metadata such as rating, dated added, play count, playlist membership, etc. lives only in the iTunes library, so this is lost if you reimport the lost content and clean up. I have a script called DeDuper which can preserve some of this information, but not date added. Video files may also lose some properties that would normally be captured in tags for mp3 or aac files. There is a slim possibility that the DeDuper script won't be able to match your reimported files but again that is something that might be tweaked if needed.


I've updated FindTracks to give it a chance of finding your TV Shows if you start the search from E:\Handbrake. If you don't have any luck could you post a screenshot of running my GetInfo script against one of those Colombo episodes, or an episode where if doesn't work, so I can see what information there is to work with?


tt2

Similar questions

60 replies
Question marked as Top-ranking reply

Jul 5, 2018 8:04 AM in response to Edison53

There are three main approaches you can take when there are missing links in the library. You can try to move the files to where iTunes thinks they should be, you can try to use a script to predict where the file is and if found tell iTunes the new location, or you can import the files from their new locations and then deduplicate, discarding the items with the broken links. Some metadata such as rating, dated added, play count, playlist membership, etc. lives only in the iTunes library, so this is lost if you reimport the lost content and clean up. I have a script called DeDuper which can preserve some of this information, but not date added. Video files may also lose some properties that would normally be captured in tags for mp3 or aac files. There is a slim possibility that the DeDuper script won't be able to match your reimported files but again that is something that might be tweaked if needed.


I've updated FindTracks to give it a chance of finding your TV Shows if you start the search from E:\Handbrake. If you don't have any luck could you post a screenshot of running my GetInfo script against one of those Colombo episodes, or an episode where if doesn't work, so I can see what information there is to work with?


tt2

Jul 3, 2018 2:17 AM in response to Edison53

How did you decide that a file was not "an iTunes file"?


To my knowledge, media files are not specifically identifiable as iTunes Library files, although if you check a file's properties it may well be marked as "open with iTunes", so perhaps you have deleted the files after all.


If you deleted them using your Windows file manager, then they should hopefully still be in your recycle bin. Go the the recycle bin to see if they are listed in there. If they are, use the recycle bin feature to restore the files (to their original location). You should be able to bulk-select the files and restore them all with one additional click. You will then need to start each one playing in iTunes in order for iTunes to realise that the file can now be located again.


You need to make sure you understand what happened that caused these files to be lost from your iTunes Library in the first place.


Remember, your music is not "in iTunes" at all. All iTunes does is keep a list (a database) of your music and videos and a note of where each file is located. If you let iTunes manage the location of the media when it is added to your Library, that media is usually located in the iTunes folder, but this is not always the case. I have plenty of imported MP3 files, and music purchased from Amazon, Beatport etc. that is not located in the iTunes folder.


As I stated previously, there is nothing specific in a media file that says it is being used by iTunes.

Jul 3, 2018 12:13 PM in response to Edison53

Use Edit > Preferences > Advanced to tell iTunes that the media folder is G:\Music. I'm assuming your other albums are to be found in G:\Music\Music\<Album Artist>. iTunes may offer to consolidate files after changing the media folder. Say no at this point. Close iTunes and reopen. Can iTunes play Let's Dance now? If not what does it think the location should be now?


tt2

Jul 3, 2018 4:34 AM in response to Edison53

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

Jul 3, 2018 7:00 AM in response to Edison53

The .itl file is the one that counts. The XML is for third party support. If present it gets rebuilt with every change in the .itl so if the main library is damaged the XML won't usually be useful. See Empty/corrupt iTunes library after upgrade/crash. This might help depending on exactly what has happened and what housekeeping steps you took. The media folder location under Edit > Preferences > Advanced should normally point to the iTunes Media folder inside your main iTunes folder. The three details mentioned at the bottom of my earlier post might shed some light.


tt2

Jul 4, 2018 1:03 PM in response to Edison53

When the script prompts for a folder to search you should normally aim at the iTunes Media folder that would then contain, for example Music, Movies, Podcasts, and TV Shows subfolders for each of those media kinds. It won't do an exhaustive search from the root of the drive. At most I think it searches three folders deep. It should also work with a flatter structure so if, for example, all tracks by an artist had been put into a single folder it may still manage to reconnect them even though the expected Album Artist and Album folders aren't there. It may not fare so well if the file names of the videos don't align roughly with the metadata in iTunes. In the example given above of a file that was called Matlock s3_d2.title2 but is now called The D.J..m4v the script is more likely to be successful if the show title in iTunes is The DJ than it will be if reads Matlock s3_d2.


The script can be tweaked as long as there is a reasonable way to predict where any given mislaid file might actually be based on properties that can be read from iTunes. Unfortunately the old path beginning file://localhost isn't accessible to the script.


tt2

Jul 3, 2018 12:48 PM in response to Edison53

If iTunes already knows how to reach those files then making the change shouldn't break them, but definitely don't consolidate. If those are broken too then you might be best off manually moving all of the components of the library into the correct structure as shown in Make a split library portable, i.e. library files copied into G:\iTunes, your current G:\Music renamed as iTunes Media and then moved inside G:\iTunes and your video files (assuming there is room) into their respective <Media Kind> folders inside iTunes Media. Rebuild all this on a bigger drive if required. Once it is all in the right layout you can try iTunes' own repair method or my script.


tt2

Jul 5, 2018 1:13 PM in response to Edison53

Try my new FindFiles script which I hope will work to repair the original broken links to the TV shows. This is the result of running the script against my entire media folder, having first renamed the folder my Heroes TV show to something random, thus disconnecting 34 items from the library.

User uploaded file


It should be even more efficient run against your HandBrake folder, at least on the indexing front.


Run it from the TV Shows section of the library (when fixing TV Shows) rather than a playlist otherwise after fixing the link iTunes will move the updated item into the Home Videos section of your library. The script can repair that but only if it knows it is working with TV Shows.


You should be able to sort your TV Shows as a list in the Episodes layout by date added and remove the most recent entries without deleting the underlying files to tidy things up.


tt2

Jul 8, 2018 11:44 AM in response to Edison53

The idea of the ExportImportAltKey script it to connect to a library that has the metadata such as show name, episode ID, season no. etc, and export that data, even if the file is missing, then connect to a library where the files have been imported, and reattach the saved data. I've tried it here exporting data from my Heroes TV series, making a few minor edits in the exported text file, then importing those changes. I renamed the folder before the export so that iTunes wasn't able to connect to the shows, but the visible data in the library was successfully exported. Having used the FindFiles to repair the broken links in iTunes I then dragged my edited text file onto the ExportImportAltKey script while my TV show as in view and my edits were applied.


I'm not sure why this isn't working for you. It might be useful to try another script GetInfo on an item that you can identify in both libraries, i.e. one with metadata that cannot find the file and one where the file plays but details are missing. Comparing screenshots of the two different outputs might make things clearer.


tt2

Jul 4, 2018 1:40 PM in response to Edison53

Can you paint a picture of your folder layout for videos and how it maps to the metadata in iTunes with one or two representative examples or BNF? For example my own TV files are at:

<Media Folder>\TV Shows\<Show>\[<EpisodeID> ]<EpisodeName>.<Ext> e.g.

D:\iTunes\iTunes Media\TV Shows\Heroes\s01e01 Genesis (AKA In His Own Image).mp4


Once I can see the connection I should be able to knock up a tweak to the script to make it more effective for you.


tt2

Jul 5, 2018 5:52 PM in response to Edison53

Don't be too quick to give up. Another of my scripts, ExportImport, might provide a possible starting point. It should be possible to connect to one of your older library files, export the information that has been lost, then reconnect to the current library and import the data. The trick will be to rejig the script to use file size as the key to link up the different sets of entries in the two libraries. This ought to be a relatively easy tweak, but 2am is the wrong time for me to look at it. 😉


tt2

Jul 9, 2018 9:40 AM in response to Edison53

When you add content to a new library you lose any metadata that isn't held in tags, such as rating, play counts, date added, playlist membership, etc. Ideally I would recommend you keep one master library in the portable shape of an iTunes folder, containing an iTunes Media folder, that contains all of the media in different Media Kind subfolders. And then clone that library to a different drive for security. Using one of the ExportImport scripts can potentially help with the lost metadata but it cannot help with date added. Since you've got the exported data for the TV shows and been able to successfully reattach it to them (bar some cleanup) it seems you should start with your library where you've already got all of the music working properly. Delete the broken links to the TV Shows in that one, import the TV show files, use the script to update the metadata, then work on getting your library into a more standard shape. Depending on space the easiest way is to copy your active set of library files into X:\iTunes, where X: is a drive with enough room for the whole library, shift-start iTunes to open X:\iTunes\iTunes Library.itl, then consolidate the library into X:\iTunes\iTunes Media. Backup up X:\iTunes to another drive, then finally clean up all of the old copies of content that you no longer need.


tt2

Jul 11, 2018 11:21 AM in response to Edison53

So the file sizes are different, which is why neither script works. I'd be surprised if Album alone would be a unique key for your video files but adding duration might work.


In the ExportImportAltKey script there is a line (858 in Function Signature) that reads:


Signature=LCase(GroupDig(.Size) & " bytes")


Try changing this to:


Signature=LCase(.Album & "\" & GroupDig(.Duration) & " seconds")


Then run another export and import.


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 cannot find files

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