| 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) |