Skip to content

Instantly share code, notes, and snippets.

@clayallsopp
Created February 25, 2011 21:13
Show Gist options
  • Save clayallsopp/844506 to your computer and use it in GitHub Desktop.
Save clayallsopp/844506 to your computer and use it in GitHub Desktop.
Sorts files added to folder into subfolder
property Docs : "Macintosh HD:Users:<YOUR NAME>:Downloads:Docs"
property Music : "Macintosh HD:Users:<YOUR NAME>:Downloads:Music"
property Videos : "Macintosh HD:Users:<YOUR NAME>:Downloads:Videos"
property Images : "Macintosh HD:Users:<YOUR NAME>:Downloads:Images"
property Profiles : "Macintosh HD:Users:<YOUR NAME>:Downloads:iPhone:Profiles"
on adding folder items to thefolder after receiving theAddedItems
repeat with eachitem in theAddedItems
tell application "Finder"
if (name of eachitem ends with ".png") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".JPEG") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".gif") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".jpg") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".jpeg") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".PNG") then
move eachitem to folder Images
end if
if (name of eachitem ends with ".mov") then
move eachitem to folder Videos
end if
if (name of eachitem ends with ".avi") then
move eachitem to folder Videos
end if
if (name of eachitem ends with ".wma") then
move eachitem to folder Videos
end if
if (name of eachitem ends with ".m4v") then
move eachitem to folder Videos
end if
if (name of eachitem ends with ".mp4") then
move eachitem to folder Music
end if
if (name of eachitem ends with ".mp3") then
move eachitem to folder Music
end if
if (name of eachitem ends with ".wav") then
move eachitem to folder Music
end if
if (name of eachitem ends with ".wma") then
move eachitem to folder Music
end if
if (name of eachitem ends with ".pdf") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".doc") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".docx") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".pages") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".ppt") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".pptx") then
move eachitem to folder Docs
end if
if (name of eachitem ends with ".mobileprovision") then
move eachitem to folder Profiles
end if
end tell
end repeat
end adding folder items to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment