Create new folders in the current directory


I’d like to create a bunch of folders in the current directory when I press the trigger. I’ve used the new folder action but it doesn’t seem to create the folders in the current directory. I’m not sure where it’s creating them.



I have a macro, which does this.

We use it at my work to create the basestructure of a folder on our network for a job. I work at an Ad Agency/Printer.

It start with presenting a prompt asking for up to 5 supplier-names.

The folders are created, in the folder you are in, in the Finder.

Keyboard Maestro “Create basestructure for order folder” Macro

Create basestructure for order folder.kmmacros (10 KB)

1 Like


Thanks for sharing.

I was trying “execute a shell script” with mkdir {test1,test2,test3} but I get permission denied. I go to the Terminal, execute the same command and it works just fine. Not sure why it’s not working from KM.

mkdir: test1: Permission denied
mkdir: test2: Permission denied
mkdir: test3: Permission denied

What is the current working directory in each case?

The current working directory for a script executed by Keyboard Maestro is undefined. Try:

cd ~
mkdir {test1,test2,test3}

or the equivalent.

Hey @skyblue

The New Folder action has no concept of “the current directory” – you have to provide a proper path.

It can be a $HOME-based path or an absolute path:


~/Documents/test dir # KM handles any quoting necessary.


* Keyboard Maestro only handles quoting in its own actions.

Why don’t you provide a sample directory structure, so we can better understand what you’re doing?

Please also define what you mean by current directory.


[quote=“peternlewis, post:4, topic:2888”]cd ~
mkdir {test1,test2,test3}[/quote]

Hey @skyblue

This of course is using an Execute a Shell Script action.

If you employ that method make sure to NOT put any spaces in along with the commas, as that will have unintended side-effects.

IF you have any spaces in your directory paths, the path must be quoted or or the spaces escaped.

cd ~/test_directory/KM_TEST/
mkdir ~/test_directory/KM_TEST/my test folder

This will create three directories in the designated folder, instead of the one “my test folder” we wanted.

These forms WILL work as we want them to:

mkdir ~/test_directory/KM_TEST/my\ test\ folder
mkdir ~/test_directory/KM_TEST/'my test folder'
mkdir ~/'test_directory/KM_TEST/my test folder'

* If you put a quote mark in FRONT of the ~ it will fail.