Script to create a Set of Folders within Currently Selected folder(s)

I have a script that I've been using for years that will create a set of folders within whatever selected folders I have (based on a script called 'NewFoldersSelect'). However, I'd like to modify the script to then create sub-folders within a few folders that were just created. How would I go about that?

So, for example, after the top layer of folders are created (folderNames), I'd like to create another set of folders titled "1", "2", "3", and "4" inside of the "RENDERS" folder (or any other folders from that initial set).

Sorry, I've looked through the forum and didn't see anything that I recognized that would apply to this code.

Re: Script to create a Set of Folders within Currently Selected folder(s)

Hi. Welcome to MacScripter.

It's possible to write a recursive routine using the Finder, but "mkdir" shell scripts work faster and are easier to write — once you're used to them!

Applescript:

-- To get subfolders "1", "2", "3", and "4" in the "RENDERS" folder only:property hierarchy : "{'ANI & PATENT',ARCHIVE,IMAGES,'ONLINE INFO',PQM,PROOFREADING,PROOFS,RENDERS/{1,2,3,4},'SOURCE DOCS'}"-- To get them in, say, both "PROOFS" and "RENDERS", use this instead:-- property hierarchy : "{'ANI & PATENT',ARCHIVE,IMAGES,'ONLINE INFO',PQM,PROOFREADING,{PROOFS,RENDERS}/{1,2,3,4},'SOURCE DOCS'}"-- Or to get them in all the folders:-- property hierarchy : "{'ANI & PATENT',ARCHIVE,IMAGES,'ONLINE INFO',PQM,PROOFREADING,PROOFS,RENDERS,'SOURCE DOCS'}/{1,2,3,4}"

Edit: Here's a devious variation which only needs to call 'do shell script' once, even when multiple folders are selected. I don't know if it's necessarily any better. (Further edit: Script below debugged to allow for single-folder selection (!) and both scripts now give explanatory error messages when the running conditions aren't met.)

Applescript:

-- To get subfolders "1", "2", "3", and "4" in "RENDERS" only:property hierarchy : "{'ANI & PATENT',ARCHIVE,IMAGES,'ONLINE INFO',PQM,PROOFREADING,PROOFS,RENDERS/{1,2,3,4},'SOURCE DOCS'}"-- To get them in, say, both "PROOFS" and "RENDERS", use this instead:-- property hierarchy : "{'ANI & PATENT',ARCHIVE,IMAGES,'ONLINE INFO',PQM,PROOFREADING,{PROOFS,RENDERS}/{1,2,3,4},'SOURCE DOCS'}"-- Or to get them in all the folders:-- property hierarchy : "{'ANI & PATENT',ARCHIVE,IMAGES,'ONLINE INFO',PQM,PROOFREADING,PROOFS,RENDERS,'SOURCE DOCS'}/{1,2,3,4}"