Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #generate a list of all archives of the all dirs starting from the execution dir; just 14 lines of code! <3 Python
- import os
- def treeGenerator(path, list = []):
- files = os.listdir(path)
- for f in files:
- if os.path.isdir(f):
- os.chdir(f)
- newPath = path + '/' + f
- treeGenerator(newPath, list)
- os.chdir('..')
- else:
- list.append(f)
- return list
- path = os.getcwd();
- print(treeGenerator(path)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement