2

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.

patzm
  • 973
  • 11
  • 23
  • 1
    Does this answer your question? [What tool to use to draw file tree diagram](https://stackoverflow.com/questions/347551/what-tool-to-use-to-draw-file-tree-diagram) – dank8 Oct 31 '22 at 14:48
  • 1
    Your question is probably more relevant to (Software Recommendations)[https://softwarerecs.stackexchange.com/] – dank8 Oct 31 '22 at 15:26
  • Thanks @dank8, but no. The `tree` alternative is already described in my question, but I want to avoid creating actual files and folders. Graphviz seems more work than actually creating files and folders. – patzm Oct 31 '22 at 20:06

2 Answers2

4

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

Adam
  • 840
  • 6
  • 24
1

What you have expressed as input is very close to YAML structure.

I'm unable to determine where you want to use the beautified result.

are you a developer bulk document generation:

are you a technical or business writer giving a presentation:

dank8
  • 361
  • 4
  • 20
  • thanks! I like the YAML idea. Even though the proposed rendering of [this answer](https://stackoverflow.com/a/53143122/3702319) isn't as compact (and hence beautiful) as I'd wish. Maybe I will write a quick `yaml-tree` tool that mimics the output format of `tree` but parses yaml files. – patzm Oct 31 '22 at 20:08