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"