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 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.

89 Responses to “How to remove deleted files from your iTunes library”
  1. Jay says:

    You just saved the world! It worked well but my edited IDv3 tags were not updating hence I deleted the entire library and then reimported everything.

  2. Martin Walke says:

    Brilliant! Having had a double import of music from my other library, I had to get rid of loads of broken links. This is a god send!

  3. Rob says:

    Thanks so much!!!!

  4. RobFoxDurban says:

    You are my new hero. I just can’t believe how lazy iTunes developers are.if its not there find it.if you can’t find it offer to clean up after yourself.
    After all it’s you that copied and created all the duplicates.

    Well done Jay,drinks on me for you!!!!!!!

  5. spike says:

    Worked a treat, many thanks.

  6. Varun says:

    excellent job Jay. Kudos.

  7. daveking says:

    Dude that is awesome! You help when Apple doesn’t.

  8. Zed says:

    You are amazing. I searched for this on the off chance since I got fed up with manually looking through over 12000 songs! THANK YOU!

  9. ashraf says:

    please —–> Helpe me ,,, im not understand .. i have this problem .. please Helpe me

  10. Ismail says:

    Fantastic ! Many thanks.

  11. Adel says:

    What a beautiful hack! thanks a lot.

  12. Charlie says:

    Cheers man, much appreciated

  13. San says:

    Dude you are a rockstar

  14. Many thanks. WinAmp solved our problem with the function ” delete all non playable items” (http://gerritendekrekels.blogspot.nl/)

  15. Jay2k1 says:

    Yeah, iTunes really needs a function like that.
    Are you just comparing WinAmp with iTunes or can you actually edit the iTunes library using WinAmp?

  16. [...] process I used is detailed in this link here - you should absolutely give it a go if you had the same problem I [...]

  17. Paul murphy says:

    I wount to remove for 9.euro

  18. Steve says:

    Thankyou for this great tip much appreciated

  19. Paul says:

    Top banana :) Worked a treat – thank you

  20. Pete says:

    You, sir, are a fucking genius!

    Worked an absolute treat! :)

    Can I buy you a beer?

  21. Joseph says:

    I created a Python script to remove duplicates from the filesystem based on md5 checksum, and then used your technique to clean up iTunes. Thanks!

  22. Dennis Flanders says:

    Thank you for posting this. …and thank you for providing a solution to something Apple should have included in the tragic mess that is iTunes.

    I’m sorry for using this thread to rant but it’s precisely this sort of thing that drove me away from Apple long ago. My wife and son still use iPad’s but they’ve just about had it with iTunes. Both are looking hard at Android tablets at this point. I have 30+ years in IT and I’ve encountered very few applications as counter-intuitive and as poorly executed as iTunes.

  23. Byron says:

    Amazing – thank you so much!

  24. Wouter says:

    Many thanks for this post! Your idea worked flawlessly!

  25. Cameron says:

    With the number of missing functions in iTunes just like this one talked about. I just occasionally backup my playlists and then just uninstall and reinstall iTunes every now and then. Accommodating for iTunes system cleanup. iTunes does not monitor folders that were added to iTunes Library for additions and subtraction and modification of files names within the folders that were added to the iTunes Library.

  26. Hannah says:

    Your instructions are both helpful and fun! Thanks!

  27. John says:

    Thanks man, this worked great. I had 20GB of deleted music files and didn’t know how to quickly delete them!

  28. J says:

    If you’ve got tens of thousands of songs like I do, dragging and dropping can be a real pain (pinwheel/beach ball/hourglass, etc. for several minutes only to find the playlist doesn’t allow dropping this quantity, nor certain smaller quantities). Instead, after selecting all, right-click (Windows) or control-click (Mac)/two finger-tap (newer Mac trackpads and Magic Mouse) – then, select “Add to Playlist” > “Working Entries”

  29. J says:

    I’m using iTunes 11.0.2 and tracks with the (!) did in fact transfer to the “Working Entries” playlist. So, unfortunately, this does not apply. Maybe I’ll just delete the .xml file and re-import as I have not found a way to do this to these tens of thousands of files.

  30. Tony Spamoni says:

    Thank you for saving me weeks/months of trying to find and delete these files by hand. When I return the hard drive that I accidentally erased with all of her music on it with some semblance of order, she’ll thank you also!

  31. Huhu says:

    If I try to delete songs from a playlist (iTunes 10, OS X 10.6) this beauty of program would just delete the titles in teh playlist … NOT in the library.
    How I love apple.

    Any idea? Is this a iTunes10 issue?

  32. Jay2k1 says:

    Try key combinations like ctrl-delete or shift-delete etc.

  33. Phil says:

    Genius! I paid for some software (there wasn’t a demo) which took nearly a minute to remove EACH broken link from iTunes. With 4000 broken links that was a bit too slow! At least the developers refunded me. But your method is sensational! Thank you!

  34. boborama says:

    Brilliant…simply brilliant

  35. Michele says:

    OMG! I am a dj on a commercial radio, and to forward announce something in itunes that wasn’t there was common with 100+ broken links!!! Thanks so so so much! You have made my day/week/year/millenium!! :)

  36. Madhan says:

    Working thanks. But, am not able to see delete option to delete broken entries from smart playlist as “broken entries”. Please help me.

  37. Tuneup Media says:

    Nice blog. Sir i am using the old version of iTunes and i tried to remove duplicate songs but i was unable. So can you suggest me a better idea that can help me to do that?

  38. Laura says:

    TY TY TY TY TY Many thanks

  39.  
Leave a Reply