Planter takes in simple, indented text files to define the structure of the directory tree it’s going to create. You pass it something like:


And it creates:


There are three ways to call plant:

  • Pipe indented (tabs or 2 spaces) text to the script
    • e.g. `cat “mytemplate” | plant
  • Create template.tpl files in ~/.planter and call them by their base name
    • e.g. Create a text file in ~/.planter/site.tpl
    • plant site
  • Call plant without input and it will open your $EDITOR to create the tree on the fly

You can nest directories as deeply as you like. You can pass the indented list to it on STDIN (piping from another command), or run plant alone and it will open up your default editor and let you define the list on the fly. You can also use templates…


Create ~/.planter/ and add text files named “[template].tpl”, where “[template]” is the short name you’ll call it with. Say I have “~/.planter/client.tpl”, I can just run plant client and it will read that template in and create the directory structure in whatever directory I’m in when I run it.

If there are non-template files in ~/.planter, you can reference them in templates and a copy of the file will be created at that point in the directory tree. For example, if you had an index.html, a style.css and a jquery.js file in your template folder, you could make a web.tpl template like this:



You can also use a very basic template variable system to add variable content. In your template, use %%X%% where X is an integer. The number corresponds to the arguments passed on the command line after the template name, so %%1%% is replaced with the first argument:

In the template:


On the command line:

plant client "Deborah Winger"


./client-Deborah Winger
./client-Deborah Winger/expenses
./client-Deborah Winger/contracts

You can assign default values to variables to make them optional when planting a structure from a template:


If you want to specify variables for just some positions, use “-“ or “.” for arguments in the command to force the default for that position.


Set tags on created folder and copied items items by adding @TAGs at the end of the line in the template. To make a variable placeholder function as a tag, put the @ between the % and the replacement number at the beginning (e.g. %%@2%% or %%@1|default%%). Unless the –no-tagify option is used, variables identified as tags will have spaces removed and be lowercased. Tags set on a folder or file will replace existing tags. Running a “plant” after the folder already exists will not overwrite any folders, but will update/replace tags.

The @ symbol is removed by default. To add a character prefix to ALL tags, use “–tag-prefix @” on the command line. Otherwise, just include any symbols or characters needed on a one-off basis in the arguments passed to a template, or include them in the template.

// test.tpl
// tag "folder name" with "foldertag" and "@foldertype"
folder name @foldertag @@foldertype

Add comments in templates with “//”. This can be anywhere in a line, anything after it will be ingored.

Post-processing scripts

Entirely optionally, the template can end with a ruby script. Separate the script from the template with “—”. It will be executed after the folders are created, and any variable placeholders in it will be replaced with command line arguments, just like in the template. You can use this to perform additional operations, notifications or further customize Planter’s functionality. To execute scripts in other languages, use Ruby’s system call:

system "python /path/to/"

# or

%x{python "path/to/"}

No hashbang is necessary in the script.

For a list of command line options, use plant -h.

Example template

// use `//` for comments
// Create a tab-indented list of nested folders.
// %%1%% will be replaced with the first command line argument
// Adding a pipe (%%1|%%) makes it optional
// Adding a string after the pipe (%%1|default%%) uses that as default
// if there's nothing passed for that placeholder
// Use @ at the start of a variable to indicate that it's a tag (%%@1%%)
// The following creates a root folder named with the first argument 
// and tagged with an "@tag" of the same name, with a directory 
// structure within it.
// If no argument is passed after the template
// the folder will be called "app" and receive no tag.
// $ plant -ct website "My Client"
// The -c and -t options turn on color and converts 
// "My Client" to myclient in the tag
%%1|app%% %%@@1|%% // if no argument is passed in the first position, call it "app" with no tags
	index.html // copied from ~/.planter/index.html
	js // jquery library will be added here
		style.css // copied from ~/.planter/style.css
# Anything following the --- break (optional) will be evaluated 
# as a script, use caution
# No hashbang
# Comments in the script portion use # and are ignored

# Use `puts` for status messages
puts "Getting the latest version of jQuery 1"

# Call external utilities and scripts in other languages 
# with %x or system:
# %x{python}
# system "python"

# Fetch a copy of the latest jQuery into the js folder
%x{curl -o "%%1|app%%/js/jquery.min.js" &> /dev/null }


Planter v2.1.4

Instantly create nested directory structures from indented text with tags and post-processing scripts

Updated Wed Jan 15 2014.

DonateMore info…

An older version of Planter is also available for LaunchBar (included in the second Download). See the announcement post for details.

Planter for LaunchBar/CLI v1.3

Instantly create nested directory structures from indented text

Updated Sun May 05 2013.

DonateMore info…

Speaking of Planter…

Related Projects