用于创建“漂亮"的 ASCII 库目录树?

2022-01-05 00:00:00 ascii tree php unix

是否有一些 *nix 工具或 perl/php 库可以让您轻松创建如下所示的目录树可视化?

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

推荐答案

这个例子来自 Unix Tree/Linux树:

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^/]*//--/g' -e 's/^/   /' -e 's/-/|/'  

相关文章