Search code examples
treefilesystemsutility-method

generate text tree for a non-existant folder structure


I want to generate a beautiful text rendering of a file system / folder structure that does not exist. Imagine I want to propose a file system layout, I would like to express this in an easy way I can quickly type down. For instance, given an input like this:

another
    folder
    log.txt
final
hi.py
some
    folder
        file.txt

where hierarchy is simply expressed by Tabs. Could be any other encoding though.

I would like to get a beatiful output like tree could generate:

.
├── another
│   ├── folder
│   └── log.txt
├── final
├── hi.py
└── some
    └── folder
        └── file.txt

The goal here is to avoid typing non-type-able but beautiful characters like └── or ├──. Ideally, a web-version of this tool would be desirable.

There are a bunch of seemingly related SO posts: What tool to use to draw file tree diagram or Representing Directory & File Structure in Markdown Syntax. However, all of them need an existing folder structure.


Solution

  • I think this is the tool you want: tree.nathanfriend.io . It is a simple two pane website. On the left you enter exactly what you showed as sample input (with tabs). On the right it shows you exactly what you requested as output. Example with your sample input