Spaces:
Runtime error
Runtime error
File size: 1,060 Bytes
8490649 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | import os
# Folders to ignore
IGNORE_DIRS = {
".git",
".venv",
"venv",
"__pycache__",
".idea",
".vscode",
"node_modules",
".pytest_cache",
".mypy_cache",
"dist",
"build",
".next",
".tox"
}
# Files to ignore
IGNORE_FILES = {
}
def print_tree(start_path, prefix=""):
items = sorted(os.listdir(start_path))
# Filter ignored files/folders
items = [
item for item in items
if item not in IGNORE_DIRS and item not in IGNORE_FILES
]
for index, item in enumerate(items):
path = os.path.join(start_path, item)
is_last = index == len(items) - 1
connector = "βββ " if is_last else "βββ "
print(prefix + connector + item)
if os.path.isdir(path):
extension = " " if is_last else "β "
print_tree(path, prefix + extension)
if __name__ == "__main__":
root = os.getcwd() # current directory
print(os.path.basename(root))
print_tree(root) |