Display file tree

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

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'
| |---mbean-ws-endpoint.xml
| |---mbean.xml
| |---mbean-security.xml
| |---mbean-ws-endpoint_v2.xml
| |---mbean-ejb.xml
| |---mbean-endpoint.xml
Please remember the terms for blog comments.