```
#coding:utf-8
from os import listdir,sep
from os.path import isdir
import sys
start = sys.argv[1]
def tree(s):
if isdir(s):
files = listdir(s)
for n in files:
tree(s+sep+n)
else:
print s
tree(start)
```
这个使用python做起来非常简单,使用一个递归即可。
peter@智普教育:~/python$ python basic/tree1.py .
./httpserver.py
./2.py~
./django/jeapxihuan/jeapxihuan/urls.py
./django/jeapxihuan/jeapxihuan/wsgi.pyc
./django/jeapxihuan/jeapxihuan/wsgi.py
./django/jeapxihuan/jeapxihuan/models.py
./django/jeapxihuan/jeapxihuan/views.py
./django/jeapxihuan/jeapxihuan/forms.py
./django/jeapxihuan/jeapxihuan/static/css/bootstrap-responsive.css
./django/jeapxihuan/jeapxihuan/static/css/docs.css
./django/jeapxihuan/jeapxihuan/static/css/bootstrap.css
./django/jeapxihuan/jeapxihuan/views.pyc