ASCII Library for Creating “Pretty” Directory Trees?

后端 未结 10 1051
时光说笑
时光说笑 2020-12-04 07:33

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
|             


        
相关标签:
10条回答
  • 2020-12-04 07:44

    Have a look at App::Asciio  

    0 讨论(0)
  • 2020-12-04 07:48

    That oneliner is pretty cool, I'd recommend using the tree util.

    bash-3.2$ mkdir -p this/is/some/nested/example
    bash-3.2$ mkdir -p this/is/another/super/nested/example
    bash-3.2$ mkdir -p this/is/yet/another/example
    bash-3.2$ mkdir -p this/is/some/nested/other/example
    bash-3.2$ tree this
    this
    `-- is
        |-- another
        |   `-- super
        |       `-- nested
        |           `-- example
        |-- some
        |   `-- nested
        |       |-- example
        |       `-- other
        |           `-- example
        `-- yet
            `-- another
                `-- example
    
    13 directories, 0 files
    
    0 讨论(0)
  • 2020-12-04 07:50

    I realize this question was answered ages ago, but I just found this program called tree which is pretty cool too.

    0 讨论(0)
  • 2020-12-04 07:55

    exa with --tree does an excellent job:

    exa --tree ~/tmp/public/
    
    <dir>
    ├── aboutme
    │  └── index.html
    ├── atrecurse
    │  └── index.html
    ├── base.css
    ├── html5
    │  ├── cat-and-mouse
    │  └── frantic
    │     ├── css
    │     │  └── main.css
    
    0 讨论(0)
  • 2020-12-04 07:56

    How about this example from Unix Tree / Linux Tree:

    ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'  
    
    0 讨论(0)
  • 2020-12-04 08:01

    Cool Python script to do it: http://code.activestate.com/recipes/217212/

    0 讨论(0)
提交回复
热议问题