Skip to content

Instantly share code, notes, and snippets.

Last active March 23, 2016 16:28
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Spacerat/8772940 to your computer and use it in GitHub Desktop.
AppleScript to remove items from iTunes whose files have been deleted
tell application "iTunes"
set selectedTracks to selection
repeat with i from 1 to (length of selectedTracks)
if class of item i of selectedTracks is not shared track then
tell item i of selectedTracks to set {loc} to {get location}
if loc is missing value then
tell application "iTunes"
delete item i of selectedTracks
end tell
end if
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment