Create full folder structure from "New document" (Templates) menu

If I create a folder inside Templates, when I click "new Document" > "myfolder" it does nothing. That is just a sub directory to organize the templates.

But maybe it would be useful to create that folder hierarchy. For instance:

I have all these files and folders:

  • ~/template/tm1.txt
  • ~/template/tm2.txt
  • ~/template/myfolder/
  • ~/template/myfolder/subfolder/
  • ~/template/myfolder/subfolder/hello1.html
  • ~/template/myfolder/subfolder/hello2.html
  • ~/template/myfolder/subfolder/hello3.html
  • ~/template/myfolder/index.html

So when I click "new Document" > "myfolder" I'd like to create "myfolder" with "subfolder" and index.html (etc....).

Is there any way to do this?

I know that "new Document" isn't the same as "new folder", but maybe this should be called "new template".


I don't think this is possible via the Templates menu but you could create a Nautilus script to achieve the same. Something akin to the following should work:

#!/bin/bash

# Create folder structure from template

TemplateDir="$HOME/Folder templates/dir1"
WorkingDir="$PWD"

cp -r "$TemplateDir" "$WorkingDir/"

Place your folder with subfolders and files in ~/Folder templates and modify the TemplateDir line accordingly. Then follow these instructions to install the script.

When you're done, right click on an empty area in your Nautilus window and select Scriptsyour script name. This should create a copy of your template directory in the current folder.


I have a Nautilus extension that hopefully does what you're looking for. See the following website:

nautilus-new-folder-from-template

This extension allows you to create directory-templates, and choose from among them using the right-click context menu.