Loading...

Display file tree

If you want to display a file structure of a folder and the tree command is not available, use sed to replace to create a tree structure based on the find output.

Following command was invoked on rhel 7.1 (Red Hat Enterprise Linux).

tan@cinhtau:~$ find metrics -print | sed 's;[^/]*/;|---;g;s;---|; |;g'
metrics
|---s01
| |---mbean-ws-endpoint.xml
| |---mbean.xml
| |---mbean-security.xml
|---mbean-os.xml
|---s04
| |---mbean-ws-endpoint_v2.xml
| |---mbean-ejb.xml
| |---mbean-endpoint.xml
|---mbean-memory.xml
|---mbean-http.xml
|---mbean-transactions.xml
|---mbean-datasource.xml