Skip to content

Instantly share code, notes, and snippets.

@MOOOWOOO
Created September 19, 2016 03:58
Show Gist options
  • Select an option

  • Save MOOOWOOO/8ff737a579dad349f45b0a73f2a0bf35 to your computer and use it in GitHub Desktop.

Select an option

Save MOOOWOOO/8ff737a579dad349f45b0a73f2a0bf35 to your computer and use it in GitHub Desktop.
print tree of dir
import os
def Test3(rootDir, level=1):
if level==1:
print(rootDir)
for lists in os.listdir(rootDir):
path = os.path.join(rootDir, lists)
print('│ ' * (level - 1) + '│--' + lists)
if os.path.isdir(path):
Test3(path, level+1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment