Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save krisai/82a8cbc4ff12f8ee7d8c5ce57128bb6c to your computer and use it in GitHub Desktop.
Save krisai/82a8cbc4ff12f8ee7d8c5ce57128bb6c to your computer and use it in GitHub Desktop.
set mylist to {"Beats", "Brasil", "Dubstep/Grime", "Groove", "Jungle/DNB/Electronic", "Rap", "Reggae/Dub", "Trap", "Trip-Hop"}
set loc to choose folder "Choose Parent Folder Location"
tell application "iTunes"
set myPlaylists to every playlist
repeat with myPlaylist in myPlaylists
if mylist contains name of myPlaylist then
set playListName to name of myPlaylist
set myTracks to every track of myPlaylist
tell application "Finder"
if not (folder playListName of loc exists) then
set targetFolder to make new folder at loc with properties {name:playListName}
else
set targetFolder to loc & playListName as string
end if
end tell
repeat with myTrack in myTracks
set trackName to name of myTrack
set trackArtist to artist of myTrack
set trackFile to location of myTrack
tell application "Finder"
set aName to name of trackFile
if not (exists targetFolder & ":" & aName as string) then
duplicate trackFile to targetFolder
end if
end tell
end repeat
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment