Linux lists the directory tree

zhaozj2021-02-11  206

List the directory tree

Skill administrator (2000-12-22 23:53) 〖Back〗 〖Forward〗

The short shell program below can list the directory tree, which takes full advantage of SED powerful mode matching capabilities. The directory tree form is as follows: `---- shellp` ---- Updates `---- wu-ftpd-2.4 | `---- DOC | |` ---- Examples | `---- SRC | |` ---- config | | `---- Makefiles |` ---- Support | --makefiles | `---- man |` ---- Util script is as follows: #! / bin / sh # dtree: usage: dtree [any directory] DIR = $ {1: -.} (CD $ DIR ; PWD) Find $ DIR -TYPE D -PRINT | SORT -F | SED -E "S, ^ $ 1," -e "/ ^ $ / d" -e "s, [^ /] * / ([^ /] *) $, `---- 1," -e "s, [^ /] * /, |, g"

转载请注明原文地址:https://www.9cbs.com/read-3578.html

New Post(0)