'tree' command for Mac OSX

‘tree’ 這個指令在許多系統中都存在,用途是繪製出目錄的樹狀結構,在寫技術文件時,這個功能非常方便。

不過 Mac OS X 沒有這個功能…. (殘念

搜尋了一下,果然有高手提供的替代方案

find . -print | sed -e 's;[^/]*/;|--;g;s;--|; |;g'

紅色的點可以替換成需要的目錄名稱,點則代表當前目錄。取得的目錄樹長這個樣子

|--assets
| |--bootstrap
| | |--3.1.1
| |--draw.js

 


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *