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

Automator: Create folder with name and subfolders in it.

Hello everyone, my question is related to Automator. I work in a company where we have a huge server. Every time a new job comes in it gets a six digits number and a folder with 5/6 subfolder needs to be created. The main folder will be xxxxxx_nameofbrand and will contain 5 subfolder each one of them starting with the six digit number assigned initially followed by 5 tags (always the same ones).

Everytime it's a long thing to create it manually and copy and paste every number and name, so I thought I could use automator to do it easilly but I always get stucked at the part where I want the 5 subfolder to go in the main one. This is what I had done, but I'm pretty sure there is a faster/easier way to do it.. I'm really new to automator, I know it's potential but don't know how to use it very well..


I thank you all for the help.


User uploaded file

User uploaded file

iPhone 4, iOS 7.0.4

Posted on Feb 20, 2014 9:53 AM

Reply
Question marked as Best reply

Posted on Feb 21, 2014 9:59 PM

I have a Copy Folder Structure action that is designed for this kind of thing. It doesn't create a folder structure, but instead copies a structure from an arbitrary template folder, so that the template can be created normally using the Finder and edited later if needed (to add, remove, rename subfolders, etc) without having to change the Automator workflow.


The action can be downloaded here, and a workflow using it would look somethng like:

User uploaded file

6 replies
Question marked as Best reply

Feb 21, 2014 9:59 PM in response to TomFonta

I have a Copy Folder Structure action that is designed for this kind of thing. It doesn't create a folder structure, but instead copies a structure from an arbitrary template folder, so that the template can be created normally using the Finder and edited later if needed (to add, remove, rename subfolders, etc) without having to change the Automator workflow.


The action can be downloaded here, and a workflow using it would look somethng like:

User uploaded file

Feb 22, 2014 11:20 AM in response to red_menace

Woah, this is a great idea..!Thank you so much red_menace.

I was wondering, I've limited to copy depth to 2 since I have one more folder in a subfolder. This has a name called Links but I don't want it to be affected by the "Add Job Number.." order, just leave it called as Link. Do you think this is possible?


One last thing. What would be the best way to output this workflow? So I could have an action on desktop I just need to click to operate it without opening Automator. A lot of people won't know how to use it and I just wanted to make it as simple as possible..


"Solved the second question by creating it as an Application."


Thank you again!

Feb 22, 2014 1:39 PM in response to TomFonta

For this kind of exception, you can just add a Run AppleScript action at the end of the workflow - for example, the following will rename all folders ending with the specified name that are at the specified depth in the structure:


on run {input, parameters} # remove prefix from folder name   set sourceFolder to quoted form of POSIX path of (input as text)     set exceptionName to "Links" # will find a name ending with this (case sensitive match)   set exceptionDepth to 2 # at a folder depth of this     set theFolders to (do shell script "find " & sourceFolder & " -name " & quoted form of ("*" & exceptionName) & " -depth " & exceptionDepth)     repeat with anItem in paragraphs of theFolders # rename without prefix     tell application "System Events" to set name of folder anItem to exceptionName   end repeat     return input end run

Automator: Create folder with name and subfolders in it.

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