How to remove deleted files from your iTunes library

I use a little tool to manage my MP3s called “MP3 tag tools“. It’s quite powerful, it allows you to mass edit some or all ID3 tag fields, fill them from a file name scheme and vice versa (create folder structures and/or file names from the ID3 tag fields). Now when I recently cleaned up my collection using that tool, I noticed that I had about 400 double entries. I just didn’t notice before because the file names were different. Now as this tool tried to rename the files and put them in the appropiate subfolders, it threw error messages that existing files can’t be overwritten.

So I had 400 files that I could safely delete, which I did. Now I had 400 dead entries in the iTunes library (marked with a !) which I wanted to get rid of easily. Apparently, iTunes does not have a function to remove dead/broken/orphaned entries, I’d have to try to play every song from my playlist so iTunes would mark all missing entries and then… then what? iTunes doesn’t even let me sort by the ! column. That’s really stupid.

There is a solution though:

  1. Create a smart playlist with the criterion “Artist” is not “xxxyyyzzz” (or some other random string that does not occur as artist in your mp3 collection). Then name this smart playlist “all entries”. This way, we get a smart playlist with all database entries, working and broken.
  2. Create a static playlist called “working entries”.
  3. Open the “all entries” playlist, select all (ctrl-a/option-a) and drag the selection to the “working entries” playlist. iTunes will not copy dead entries, so now we have a list with everything and another with only the working ones. We need to substract them from each other. This is how:
  4. Create a smart playlist with the following criteria: “Playlist” is “all entries”, “Playlist” is not “working entries”. Check that all rules apply, not any rule. And dang! We just created a playlist of broken database entries. In this playlist, select all (ctrl-a/cmd-a) and hit shift-delete (alt-backspace on macs). iTunes will ask you if you want to remove the selected items from the iTunes library. Of course you want to!

Another way would be to deleteĀ My Music\iTunes\iTunes Music Library.xml and have iTunes re-import all the songs, but that would delete all the other information too, like number of skips, rating etc. so better not do it.

90 Comments

  1. Actually I found it much easier to just delete all files from the library and then re-add the folders with the files you want.

    1. @Spacemanspiff: Sure you can do that; you’ll lose ratings, play count and other library metadata though.

  2. BEAUTIFUL. I’ve just started using iTunes (the iphone and purchasing music from itunes demands it) and I’m having trouble figuring out its little peculiarities compared to Windows Media Player. This was amazing! And now I don’t have to do this manually, for hours, til I die. Thanks!

  3. Had been manually selecting for 5 minutes and then hoped/knew many other people probably had the same problem at some point. Thanks for providing a simple yet elegant solution. Saved me a ton of time and certainly a headache!

  4. I NOMINATE YOU FOR THE NOBEL PRIZE IN PHYSICS! Sometimes the best solutions are the simplest. Tried some Apple scripts and other useless time wasting ideas but this was by far the quickest, easiest and thus the best way to resolve this annoying problem. Thanks.

  5. Suberb – I was manually deleteing them when after an hour I got fed up and found your blog – you’ve saved me days! – I had over 20GB of deleted songs!!

  6. Thank you SO MUCH! After copying music from an iPod several times I would up with multiple copies of about 1000 songs. When I deleted the earlier attempt folders, I was left with 2 out of every 3 or 4 songs on my iTunes being unavailable. After working my fingers numb deleting them one or two at a time, I xsaid.. there must be a better way! Appreciate the help .. bu the way this is iTunes version 10.1 on Windows 7.

  7. Genius! Thanks I have downloaded a lot of garbage to try and do this, but this works.

  8. Thanks for your help, totally works! Love the “Live Updating” as well… brilliant!

  9. this is kind of a stupid question, but what exactly defines a “static playlist”

  10. Thanks man, I was going through them one by one. It’s soodumb that there isn’t an option to just remove them in itunes. Thanks again.

  11. Thanks so much for this solution. It took me all of 2 minutes to clean my list. Keep up the good work.

  12. This was perfect. After doing the updates, I had a minor heart attack when I found that I had 353 less entries in my music than in my working entries…until I realized that the difference was because the remaining 353 were not music, but movies and TV shows. So everything was perfect. Your ideas was f=great…better than my original frustrated one…which was deleting 4566 entries manually. Thanks very much!

    1. I’m glad to see that my post was helpful for a small bunch of people (and probably more who didn’t leave a comment). This alone makes me feel this blog is worth something

      Also thanks for sharing your experiences and tips.

      Jay

  13. Yes! It works. I lost a number of iTunes songs due to a dead external HDD. Stupid of me not to back them up, but that’s the way it is. I ended up with all sorts of (!) listings on my iTunes library that I wanted to clean up- this did it! Yes.

  14. As of iTunes 9.2.1.5, I wasn’t able to “drag” the files from the smart playlist to the static playlist, but I was able to right click and do that. However, it still copied the missing file tracks.

Leave a Reply

Your email address will not be published. Required fields are marked *