create folders from list

a recent digital publishing workflow required the creation of over 90 folders (one for each chapter of the book) and each of these also had to include a ‘links’ folder. imagine trying to do that manually — over 90 folders.

applescript droplet icon this is a perfect job for an applescript droplet — drop a text file on the app and watch the folders appear — as if by magic :

screen grab of finder before and after text file is dropped on droplet

this workflow starts with a comma delimited list of folder names. you could also use a tab delimited list. note: this version of the script does not handle returns (line breaks) in the list. the demo list looks like this :

screen grab of comma delimited list

you can get a copy of the CreateFolders app here

screen grab of create folders script compiled in script editor

for those interested in this sort of thing…
this script shows one way to strip leading and trailing spaces from chunks of text. it uses two repeat while loops, each of which keep repeating for as long as the associated statement is true. the repeat loop ceases as soon as the statement is false, and the script moves on.

you could use the repeat until form instead :
repeat until mgThisItem does not start with ” ”

the last part of the script shows a simple, pure applescript way to create folders in the finder. the syntax is tortured and long-winded, but it works a treat. to learn how to create folders and folder hierarchies by scripting the shell, see nigel garvey’s excellent explanation at macscripter

update : if you are in the german or dutch regions you may find that your CSV files export as semi-colon separated (rather than comma separated). in which case you would replace this line :

    set text item delimiters of AppleScript to ","

with this :

    set text item delimiters of AppleScript to ";"

macgrunt icon

21 thoughts on “create folders from list

  1. I’ve been trawling the web for a multiple folder generator and this looks like it fits the bill. Please can you send me a link to the script please, if possible … for filing boring accounts, invoices and receipts…

  2. This is going to be a godsend for me! I have an excel list of my clients and would like to create a folder for each of them. It would be very time consuming for me to create all of them manually. Would love to have the script and save a ton of time. Thanks a lot!


  3. I tried to post a comment and maybe I did but I can’t find it now. Anyhow, I’d like to try using this to create a whole bunch of folders for organizing my photos and if it works out, I’ll likely use it for my classes too later on.

  4. I’m in California (bit early for you, sorry) and just need to create individual folders from a long spreadsheet of members of a non-profit. Was hoping to figure out how to avoid doing it all manually, which I probably could have done by now, the time it’s taken me to find your neat solution (I hope).

  5. G’Day Macgrunt,
    I work with a huge Classical music collection and would like to create folders with all the classical composers in order to place my digital files. Your gem will be very handy. Thanks in advance. Cheers

  6. Hello Macgrunt,
    Wow….. i just did find your great work on this website!
    A Mac-addict since 1990, starting with a Classic1 with 9inch dislplay, end moved up to the Imac.
    Always searching for interesting stuff for trying on my dailly work at Prepress.

    I would love to try some of your project scripts like the one above……

    Kind Regards

  7. Every so often one thinks – I wish I could do this voting repetitive task in an elegant way – looks like “create folders from list” will do this. I shoot concerts and need to quickly create a list of folders for the performer lists – do it using cut and paste. Want any images for you or you kids? email me

    • G’day Tim
      More elegance, less repetition — it’s what it’s all about.
      What a great library you’ve got. I might hit you up later in the year if one of the kids ends up doing another carnival project.
      Flicking that app to you now.
      Have a good one.

  8. If possible I would like the CreateFolders.scpt to create folders from lists of items to be sorted on the Mac. Thanks.

  9. Hey Macgrunt! I loved this post!! So useful!!! Thanks for sharing this!!!
    Do you think it’s possible make one that would work with a .csv? for subfolders as well?

Leave a Reply to macgrunt Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s