How Do I: Create templated folders

Discussion in 'macOS' started by hurleyint1386, Oct 23, 2015.

  1. hurleyint1386 macrumors member

    Sep 4, 2006
    Ok, so I have a file structure that I create for every job that I do. I'm trying to think of the best way to do this and I thought automator would be the best way, but I can't find a way to make it work. I would like to either: Have an input box pop up and ask me the name of my folder, then it will create that folder as well as the designated subfolders that are all the same, or I create the folder with the name, then run a script inside that folder to create those folders. I was hoping to do this with a keyboard combination, but a menu script would work as well. I do program, so if I don't have a quick way of doing it, then this could be a fun way to play around with some OS X programming.
  2. chown33, Oct 23, 2015
    Last edited: Oct 23, 2015

    chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Do you mean "file structure" containing folders and files, or just a "folder structure" containing only folders?

    It would be pretty simple to write shell commands to make a folder structure. It's just a series of 'mkdir -p xyzzy' commands, where each xyzzy is the pathname of a new leaf folder. The -p option will create intermediate pathname folders, so it's only necessary to explicitly make the leaf items.

    There are any number of shell commands that can make files. The simplest is '>filename', which creates an empty file if it doesn't exist.

    You can make a "Run Shell Script" action in Automator, that takes input from a preceding dialog. Do the simplest thing possible and just echo the inputs, then look at Automator's Results from the shell script action.

    If you've never used Automator before, you should probably spend a little time doing a few tutorials. Those are pretty easy to find with a search engine.

    Start simple, understand each step, and then work up to the intended goal step by step.

    I have no suggestions regarding what you tried with Automator, since you didn't post anything that could be commented on. Can Automator create folders? Yes. Can it present dialogs asking for folders or filenames? Yes. Given those points, the rest comes down to "What did you try?", so please post what you tried if you want suggestions on it.

    Or you create a folder, name it, then run a Service on it, and the Service populates the new folder with the desired structure. This means you make an Automator Service.

    Or you create a folder, name it, then drop it on an application to have it populated. This means you make an Automator Application.

    Those choices, Service or Application, are made when starting a new workflow. You might want to begin with a plain simple Workflow and then when the basic actions are working, make a Service or Application.

Share This Page