Skip to content

Instantly share code, notes, and snippets.

@Spacerat
Last active March 23, 2016 16:28
Show Gist options
  • Save Spacerat/8772940 to your computer and use it in GitHub Desktop.
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