File Extension in AppleScript

Hey all,


Looking to create a simple script to move selected files to certain place around the computer.


I've got it working to were it moves the files in this example:


every file of desktop whose name extension is "mov" or name extension is "mp4" etc... and so on.


I just was wondering if there's a way to set an object

to all of those name extension I wish to include

and write the aforementioned code above to simply:


set VidExtension to ("mov","mp4"....etc)


every file of desktop whose name extension is vidExtensions

Mac mini, Other OS, 10.8.3

Posted on Feb 18, 2013 12:50 PM

Reply
3 replies

Feb 18, 2013 4:40 PM in response to JoshFree

For others if they would like to see:


set audEXT to {"mp4", "m4a", "mp3", "aif", "aiff", "wav", "m4r"}

property FoldersToMake : {"AUDIO", "VIDEOS", "Python workspace", "Documents", "PHOTOS", "Quartz Compositions", "Other"}


tell application "Finder"

repeat with newFolder in FoldersToMake

try

make new folder of folder "CleanUP" with properties {name:"" & newFolder & ""}

end try

end repeat

end tell


move (every file of desktop whose name extension is in audEXT) to the folder "AUDIO" of folder "Stuff"

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

File Extension in AppleScript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.