#/usr/bin/python
import os
def travelTree(currentPath, count=0):
if not os.path.exists(currentPath):
print "no current Path"
return
if os.path.isfile(currentPath):
fileName = os.path.basename(currentPath)
print " "*count + "|_ "+fileName
elif os.path.isdir(currentPath):
#print currentPath
print " "*count + "|_ "+currentPath
pathList = os.listdir(currentPath)
for eachPath in pathList:
travelTree(currentPath + '/' + eachPath, count + 1)
else :
print "\n"
return
travelTree('/Users/liyi/Desktop')
#travelTree('/Users/liyi/Desktop/test.sh', 1)