Print directory tree on Windows and Linux using tree, sed, awk or Python

Windows: there is ‘tree.com‘ command showing the directory structure.
http://chxkyy.javaeye.com/blog/213864

Linux: there is a ‘tree‘ program for Linux and also available on some Linux distributions, such as Debian. (apt-get install tree)
http://www.debian-administration.org/article/Commands_you_might_have_missed_tree

Sed or Awk:
The Sed version: http://www.centerkey.com/tree/
The AWK version: http://www.unix.com/shell-programming-scripting/50806-directory-tree.html

1
find . -type d -print 2>/dev/null|awk '!/\.$/ {for(i=1;i< 5  && i != 1) d=5;printf("%"d"s","|")} print ---"$NF}'  FS='/'

Finally, the Python version:
http://hi.baidu.com/limodou/blog/item/94340b7b6dca48fe0bd1870a.html

Share this:
Facebook Linkedin Twitter Digg Email

Leave a Reply