Remove missing and broken music in iTunes using this little applescript

Do you ever get annoyed that your music in your iTunes library has an old broken link? Well this little AppleScript will search your iTunes library and delete any of the alias’ that don’t have a music file attached to it.
Nice and simple.
1 – Open Apple Script Editor (start typing AppleScript into spotlight)
2 – Copy and paste the below code into your new window and click Run
3 – Save the script for using again in the future
tell application “iTunes”
set thePlaylist to library playlist 1
set musicFiles to the file tracks of thePlaylist
repeat with mf in musicFiles
--the name of mf as string
set hasLoc to ""
if (the location of mf as string ¬
is equal to "missing value") then
try
set comment of mf to the comment of mf & ""
on error number errNum
delete mf
end try
end if
end repeat
end tell


