Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Check and create folders inside another folder on the Desktop

My script presents the user with a list of options which output files using various shell scripts based on each option selected. The output files are set to go to folders with the same names as the options in the list.


Part of the script checks if the folders exist and creates them if not. Currently they are all created on the users Desktop, but to keep it a little cleaner, I'd like them to be created inside a single folder on the desktop called (for the sake or this conversation) "OutputFiles".


Here is part of the script I currently have which checks and creates the folders:


----------------------

set outputList to {¬

"1 Basic", ¬

"2 Good", ¬

"3 Better", ¬

"4 Excellent"}


tell application "Finder"

set theFolders to outputList as alias list

set N to 0

repeat with thisFolder in theFolders

if (exists folder thisFolder of desktop) then

else

make new folder at desktop with properties {name:thisFolder}

end if

end repeat

end tell

----------------------


The bit I'm struggling with is how to change the "of desktop" code to reflect ("of desktop & "OutputFiles") location. I would also need to check and create the "OutputFiles" folder first, but I guess I should be able to do that with a simplified version of the above command and run it before the repeat section:

----------------------

tell application "Finder"

if (exists folder “OutputFiles” of desktop) then

else

make new folder at desktop with properties {name:”OutputFiles”}

end if

end tell

----------------------


Would be great if I could clean this all up a bit and have the folders all reside inside the folder "OutputFiles" on the Desktop.

Thanks.

Posted on May 4, 2015 11:41 AM

Reply
Question marked as Best reply

Posted on May 4, 2015 11:57 AM

Here:


exists folder thisFolder of folder “OutputFiles" of desktop


(127046)

2 replies

Check and create folders inside another folder on the Desktop

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