Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASCII Library for Creating "Pretty" Directory Trees?

Tags:

php

unix

tree

ascii

Is there some *nix tool or perl/php library that will let you easily create directory tree visualizations that look like the following?

www |-- private |    |-- app  |    |    |-- php |    |    |    |-- classes |    |    |    +-- scripts |    |    |-- settings |    |    +-- sql |    +-- lib |         +-- ZendFramework-HEAD +-- public     |-- css     |-- images     +-- scripts 
like image 834
Alan Storm Avatar asked Oct 17 '09 06:10

Alan Storm


People also ask

How do I create a directory tree?

Creation of an entire directory tree can be accomplished with the mkdir command, which (as its name suggests) is used to make directories. The -p option tells mkdir to create not only a subdirectory but also any of its parent directories that do not already exist.

What is directory tree generator?

Your directory tree generator tool will run on the command line. It'll take arguments, process them, and display a directory tree diagram on the terminal window. It can also save the output diagram to a file in markdown format.

How do I show folder structure in markdown?

Tree command to generate nested directory structure with markdown. Copy the output to the markdown file and enclose it in three backticks(```markdown) and end with three backticks. And another way is to `pre tag in HTML which preserves the line breaks and spaces.


1 Answers

How about this example from Unix Tree / Linux Tree:

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'   
like image 197
bobbymcr Avatar answered Oct 20 '22 23:10

bobbymcr