【问题标题】:Generating textual representation of directory contents生成目录内容的文本表示
【发布时间】:2010-12-30 13:12:18
【问题描述】:

我正在寻找一个脚本来生成您所看到的目录结构的图形化文本表示。我可以这样运行:

james@computer:/.../basedir$ listdir .
basedir
|-firstsubdir
| |-file
| `-subsubdir
|   |-file1
|   |-file2
|   |-file3
|   `-file4
`-secondsubdir

james@computer:/.../basedir$

大概存在已建立的脚本?一定要写吗?

【问题讨论】:

    标签: directory plaintext representation


    【解决方案1】:

    在 Windows 和 Linux 下使用 tree 命令。

    http://malektips.com/xp_dos_0040.html

    http://www.centerkey.com/tree/

    【讨论】:

      【解决方案2】:

      tree(在 Windows 和 Linux 上 - 在 Linux 上可能需要apt-get install tree 或类似名称)。

      键入tree /?(Windows)或man tree作为命令行选项。

      【讨论】:

      • 我们去!奇迹般有效。现在为什么它没有出现在我勤奋的 Google 搜索中?
      • 对于那些刚刚发现tree 的人,两个有用的标志是-d(仅列出目录)和-L(指定递归的级别数)。
      猜你喜欢
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      • 2011-02-09
      • 2018-12-09
      • 2011-01-29
      • 2017-09-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多