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:
- 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.
- Create a static playlist called “working entries”.
- 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:
- 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.
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.
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”
Thanks man, this worked great. I had 20GB of deleted music files and didn’t know how to quickly delete them!
Your instructions are both helpful and fun! Thanks!
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.
Many thanks for this post! Your idea worked flawlessly!
Amazing – thank you so much!
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.
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!
You, sir, are a fucking genius!
Worked an absolute treat!
Can I buy you a beer?
Top banana Worked a treat – thank you
Thankyou for this great tip much appreciated
I wount to remove for 9.euro
Many thanks. WinAmp solved our problem with the function ” delete all non playable items” (http://gerritendekrekels.blogspot.nl/)
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?
Dude you are a rockstar
Cheers man, much appreciated
What a beautiful hack! thanks a lot.
Fantastic ! Many thanks.
please —–> Helpe me ,,, im not understand .. i have this problem .. please Helpe me
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!
Dude that is awesome! You help when Apple doesn’t.
excellent job Jay. Kudos.
Worked a treat, many thanks.
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!!!!!!!