Command to create new folder in current directory

I navigate the vault without the need to have the Files pane using links and the Quick Explorer plugin. This works quite fine except for a tiny hiccup. You can’t create a new folder using a command! Which I feel would be a hindrance to a lot of keyboard-oriented/minimalist workflows.

Proposed solution

I think having a command that creates a new folder (named new folder maybe) in the current directory of the active note would suffice for most workflows and is fairly straightforward.

1 Like

This can be done using Templater.

I’ve found that the Folder Notes plugin also has a similar command if you create the note first. I still think this should be a vanilla command, however.

1 Like

This was a recently added feature in v1.6 (Files: Create new folder) but it creates it in the root directory for some reason. It feels like the current opened directory makes much more sense.

How can this be done with templater?

This is the template code I use to create and parent a file to a new folder:

<%*
let folder_name = await tp.system.prompt("Folder name");
if (folder_name !== null) {
	let new_folder_path = tp.file.folder(true) + "/" + folder_name + "/" + tp.file.title;
	tp.file.move(new_folder_path);
}
%>

You can then just assign that template to a hotkey (in my case Ctrl+O)

1 Like

thanks dude! how can I assign a default template to a folder for a file created through this method? im assuming I have to create more ifs inside? or is this doable through the templater settings. I havent got it to work yet

I don’t understand the question