Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python3
- __author__ = "Prahlad Yeri"
- __license__ = "MIT"
- __version__ = "0.0.1"
- import os, sys
- def print_tree(dirname, pref = ""):
- for item in os.listdir(dirname):
- if item.startswith('.'): continue
- print(pref + item)
- if os.path.isdir(os.path.join(dirname, item)):
- print_tree(os.path.join(dirname, item), " "*len(pref) + "+" + ("-"*5))
- def main():
- if len(sys.argv) == 1:
- dirname = "."
- else:
- dirname = sys.argv[1]
- print_tree(dirname)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement