Created Nested Folders Automatically with Siri Shortcuts

If you work on projects where you have to create the same folder structure on a regular basis, like I do for my YouTube videos, it can be tedious to create and name each folder one at a time.  Fortunately, there’s a better way. 

Explainer

When I go to create a video, I create the project folder which I name based off the video project. Within that folder I have 4 folders labeled, “Audio”, Docs”, “Pics”, and “Video”.  So, the Shortcut I want to make will create a root folder with a name I give it, and then automatically create the 4 sub folders.  I’m going to have a link to the Shortcut at the bottom of this article so you can download it, but if you want to see how it’s built and how to edit it, then keep reading, or watch the video up top.

Composing the Shortcut

1: Starting in the Shortcuts app, you’ll want to hit the “Create New Shortcut” button and give it a name.  You can also set a desired icon and color if you so choose.

A picture of the main Shortcuts windows with a red arrow point to a "Plus" button that is the "New Shortcut" button

2: Now in the right sidebar search for “Create Folder” and either double-click it or drag it over to the main workbench.  It will create an action that reads “Create folder in Shortcuts at Path”.

A blank Shortcut creation window with the "Create Folder" action showing in the right search bar.

3: There are 2 options here depending on if you always want to create this folder structure in the exact same place versus any location.  If you always want your nested folders in the same location, then click “Shortcuts”, hit “Replace”, then navigate to the folder you want this structure to always be created under. 

A dialog box asking where you want to set the path for the new folder to be created.
elect single Nested Folder

4:  If you plan to make this folder structure anywhere, right click where it says “Shortcuts” in the action, and change this to “Shortcut Input”.  This will create a new action at the top for receiving input, which we’re going to use for saying where we want our top folder to be created. 

The Right click prompt on the Shortcuts section of the Create Folder action where you will Hit Shortcut Input

5: Click on “Any” in this top action, hit “Clear”, then check the “Folders” box, and click out when you’re done.

The dialog box with only folder selected.  This dialog box is in the "Receive X input from..." action box.

6: Then click where it says “Nowhere” and the right sidebar should change to the “Details” pane.  You’ll want to check “Use as Quick Action” and “Finder” so that when we’re done you can trigger this with a right-click.  More specifically, I’m going to set this up so the shortcut will create the nested folders within whatever folder I right-click on.  You can also setup a keyboard shortcut, but that’s your choice.

The Details pane with "Use as Quick Action", "Finder", and "Services Menu" selected.

7: Now we go back to the first “Create Folder” action.  Here we’re going to set the name for our top-level folder, where everything else will be created and stored in.  If this folder will always have the same name, just left click on it and name it.  If you want it to either ask you each time, then right-click on “Path”, and select “Ask Each Time”, which will change the line from “Path” to “Text”.  Clicking on “Text” again will also let you set a prompt, so I’ll just say, “Name the folder here”.

The Prompt box for naming the root folder.

9: We’ve created our top folder, so now we’re going to set what folders we want created inside of that. So, click back to the Action Library, and add another “Create Folder” action under the first one.  Then right click on the “Shortcuts” label in the new action and select “Magic Variable”. 

The dialog box on the second create folder action where we will click "Select Magic Variable"

10: The action timeline will change a little bit, and you should see an item labeled “Created Folder” between the first “Create Folder” action we added our newest one.  Click on that “Created Folder” label. 

The interface will go back to the way it was, but now the second Folder action will say “Created Folder” in the place of “Shortcuts”.  Now in “Path”, you can give it the name of the folder you want created.  In my case, my first folder was named “Audio”.

So as our timeline is now, it reads that whenever we select this Shortcut from the Quick Action menu when a folder is selected, it will present us with a text box where we type in the name of the folder to be created. A folder with that name will be created inside of the folder that we right clicked on.  After that a folder named “Audio” will be created inside of our named folder, and the script is done. 

Customizing the Shortcut and Testing

The Duplicate option in the right click menu of an action in Shortcuts

If I want more folders to be created on the same level as this Audio folder, then I can right click on the ”Audio” folder Action, hit “Duplicate”, and change where it says “Audio” to whatever other folder names I want in the new action.  And because I’m duplicating this action, it will create them all next to the Audio folder rather than within the Audio folder. If I did want to create one of the folders inside of “Audio”, then I could change the “Created Folder” selection to a new magic variable and select the “Created Folder” option underneath Audio instead.  It doesn’t nicely tell you that instead except for a little connecting line between the folder creation actions, so just be careful and perhaps add some comments using the “Comment” action. 

The Finder right click menu with the “Quick Actions” section opened up and the Shortcut we created present.

If you want to test the command, it will not run without adding some additional actions unless we select it via the Quick Actions listing by right clicking on the folder, or if you’ve set it to where it won’t receive an input and instead runs within a singular folder.  To test this, right click on a folder, go to Quick Actions, then select your action from the menu. A prompt should appear asking you to name the folder, which you’ll do, then when you hit ”Done”, you can open that folder you right clicked on and find your named folder and any subfolders the Shortcut created in there.

If you don’t see the Quick Actions menu when you right click, and you’ve confirmed you set it to run as a Quick Action in Finder, then open System Preferences, click the “Extensions” option, select “Finder” in the left sidebar, and check your Shortcuts from there. 

You can and should totally customize this to fit your needs.  For example, you can add an “If, Else” action to ask you where you want to create your Nested Folders if you don’t specify a location.  I’ve added this in my shareable version.  I’ve also commented each section to highlight what each action does and how it’s run to help you (and me) should you decide to customize it. 

Lastly, in case anyone is interested, this Shortcut also worked in the Files app on iPad and iPhone.

Nested Folders Demo Shortcut: Shortcut download: https://www.icloud.com/shortcuts/0a25c4daf1b040539ff1f03eb0db41c7

One comment

Feel free to comment.

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.