3

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".

0

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.

0

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.

  • Doesn't work. It looks like it would without nautilus-new-folder-from-template: i.imgur.com/xHTx7tU.png (Yes, I restarted Nautilus.) – UTF-8 Nov 11 '16 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.