What is a folder tree generator?
A folder tree is the picture of a project's structure that you see at the top of a README, in a pull request description or in documentation: names connected by lines, with folders and files nested under each other. The command tree prints that picture for a real directory. But most of the time you do not have the directory in front of you. You have a list of paths from git ls-files, from find, from a zip listing, or a quick outline you typed in a note. This tool turns any of those into a clean tree, and turns a tree back into plain paths.
It reads four kinds of input: one path per line (src/app/main.ts), an indented outline (spaces or tabs), a Markdown bullet list, and the output of the tree command in Unicode (├──, └──) or ASCII (|--, ` -- ``) form. The format is detected from the text, and you can force it if the guess is wrong. It can draw the result in Unicode or ASCII, as an indented outline, as a Markdown list, as JSON, or as a flat list of paths.
Everything runs in your browser. Your paths are not uploaded, and nothing you type is stored or put in the address bar; only the options you pick (such as the output style) are remembered.
How to draw a tree from paths
- Paste your paths. The page opens with a small project loaded, so you can see the result right away.
- Leave the input on Auto, or pick Paths, Outline or tree if you know the format.
- Choose how to draw it: Unicode is what
treeprints, ASCII is safe for terminals and email that cannot show box characters. - Set the order. "Folders first" lists folders before files and sorts each group from A to Z. "As typed" keeps your order.
- Optionally limit the depth to show only the top levels, add a slash after folder names, or keep the notes you wrote after
#. - Press Copy, or download the result as a text file. Use "continue with" to send it to the line tools or the text comparison.
Examples
From git ls-files to a README tree
Input, one path per line:
src/index.ts # entry point
src/utils/format.ts
package.json
README.mdOutput in Unicode, with folders first:
.
├── src
│ ├── utils
│ │ └── format.ts
│ └── index.ts # entry point
├── package.json
└── README.mdAn outline in ASCII
An outline typed with two spaces per level:
site
css
main.css
index.htmlOutput as ASCII, ready for a code comment:
site
|-- css
| `-- main.css
`-- index.htmlThe reverse: from tree back to paths
Paste the output of tree (the summary line such as "3 directories, 4 files" is ignored), choose Paths as the output, and you get one path per line, handy for scripts or for checking what a documentation tree really lists.
Limiting depth
With depth 1, a large project shrinks to its top-level folders and files. Use it to show the overall layout without hundreds of lines.
Common mistakes
- Mixed indentation. An outline that uses tabs on some lines and spaces on others can nest wrongly. Use one kind throughout, or convert it first with the tabs and spaces converter.
- A stray line in a tree. When you choose the tree input, every line must start with a branch (
├──,└──,|--) or be the first line (the root). A line of other text is reported with its number. - Windows
tree /F. That command prints files without branch characters, so it is not read. Usedir /b /sorgit ls-filesinstead and paste the paths. - A file that ends with a slash. A trailing slash means folder.
docs/creates an empty folder, whiledocswith nothing under it is a file. - Expecting the exact sort of
tree. The command sorts with your system locale; this tool compares names ignoring case and then by code point, so the order of names with symbols can differ slightly.
Frequently asked questions
Does it read the real file system?
No. A web page cannot list your folders, and this tool never asks to. You give it text, and it only reorganizes the text. For a real directory, run tree or git ls-files yourself and paste the result.
Are comments kept?
Yes. Text after a # that follows a space is kept as a note on that line and aligned in the tree. Turn "Keep notes" off to remove them.
How are folders told apart from files?
A name with a slash at the end, or with anything nested under it, is a folder. Everything else is a file. A folder with no content must end with a slash to be recognized.
Which line-drawing characters does it write?
Unicode output uses ├──, └── and │; ASCII output uses |--, ` -- ` and |. Both use four columns per level, like tree`.
How can I clean the list before drawing it?
Sort, deduplicate or filter the paths with the line tools, and compare two versions of a tree with the text comparison.