Note: Read the Updates at the bottom.
My iTunes XML database recently got corrupted and it seemed I had lost all my many hours worth of song ratings. Luckily I was able to re-construct the database through an few month old backup and my iPod. In doing so, my entire iTunes library was duplicated with broken links. Since iTunes does not currently allow you to sort by the broken (‘!’ icon), it’s a laborious, manual process to remove all these track listings.
That was until I found this ingenious process somewhere on the Apple forums:
1. Make a smart playlist called “All Files” with this rule: “Artist” is not “123456789” (or any nonsense name that won’t be in your library).
2. Make a static playlist called “All Live Files”.
3. Make a smart playlist called “Missing Files” with these rules: Match all of the following rules, Playlist is “All Files”, Playlist is not “All Live Files”
4. Select all the files from “All Files” and drag them into “All Live Files”. The dead files marked (!) will not copy over.
5. “Missing Files” will contain all of your dead files. Select all and delete. Voila, a nice clean iTunes library.
I have these three playlists in their own folder. Whenever I gather more than a couple dead tracks for whatever reason, I delete all the tracks in “All Live Files” and repeat steps 4 and 5.
How to Delete a file from a playlist:
Windows: SHIFT + DEL
Mac: OPTION + DEL
A reader named Art informed me of these reacent changes in deleting tracks in Windows:
Apple apparently added a new twist in the latest iTunes for Windows – the Delete option is disabled in a Smart Playlist. To get around this, I selected all tracks in my Missing Files folder, did Files\New Playlist from Selection (since it won’t let you drag & drop the dead tracks to a playlist), and then deleted them from there.
UPDATE October 2008:
If you are on Windows, I received an email from John Haywood:
On a PC at least, no longer can you delete files from playlists made through “File –> New Playlist from Selection.” When this didn’t work for me, my next thought was to do a mass ID3 tag edit (i.e. changing the Artist for all of the broken links to “DEAD LINK”) from within the Missing Files smart playlist, and then deleting all DEAD LINK songs from the main library page, but (understandably) ID3 tags can’t be edited from within smart playlists.
The only thing I could find that iTunes lets you change in bulk in a smart playlist that carries over to the main library is Rating. So after going through your steps to set up the Missing Files smart playlist, people should rate all broken songs 1 star, then sort in the main library by rating, and then mass delete. Whew!
UPDATE January 2009: (Thanks for this new information from Josh Watson)
On Windows, Shift-Delete DOES still work from a smart playlist (it never didn’t for me). Pressing shift and then right-clicking gives a delete option, but this didn’t seem to work. I just did it in iTunes 8.02 to remove all my dead files.
Also, you need to add the following rules to the Dead Files list:
“Podcast” “is” “false” –> or it will include podcasts
“Kind” “does not contain” “Audible” –> or it will include audiobooks (nearly deleted mine!)
“Kind” “does not contain” “MPEG” –> or it will include vodcasts (nearly deleted mine!)
Alternatively, you can drag all your audiobooks/podcasts/etc into the live files list too!
UPDATE September 2009: (Thanks for this new information from Lee McKay)
I did some playing around and figured out a way to do it using only two playlists, one smart, and one static.
1) Make a static playlist called “All Live Files” and copy your entire library into it.
2) Make a smart playlist called “Missing Files” with the rules set as ” ‘Playlist’ ‘is’ ‘Music’ ” and another rule set as ” ‘Playlist’ ‘is not’ ‘All Live Files’ ”
3) As stated in your blog, the broken songs will not transfer and “Missing Files” will contain all those broken songs.
UPDATE July 2011: (info from Mark Sutherlin)
Using Windows? Check this blog post with some current information regarding this issue.