Created
October 23, 2012 04:30
-
-
Save VienosNotes/3936663 to your computer and use it in GitHub Desktop.
add m4a files to iTunes from directory tree in AppleScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set src to choose folder | |
set target_files to getFiles(src) | |
tell application "iTunes" | |
repeat with f in target_files | |
try | |
add f | |
delay 1 | |
on error | |
log f | |
end try | |
end repeat | |
end tell | |
on getFiles(target_folder) | |
tell application "Finder" | |
tell folder target_folder | |
set tmp to {} | |
log "called" | |
set m4a_files to (get every file of target_folder whose file type is "M4A ") | |
repeat with f1 in m4a_files | |
set end of tmp to f1 as alias | |
end repeat | |
set f_list to (get every folder of target_folder) | |
repeat with f2 in f_list | |
set ans to getFiles(f2) of me | |
if (count of ans) is not 0 then | |
set tmp to tmp & ans | |
end if | |
end repeat | |
set result to tmp | |
end tell | |
end tell | |
end getFiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment