from pathlib import Path backend_dir = Path("/Users/baohoton/Desktop/Code/Chatbot-RAG/apps/backend") inits = list(backend_dir.rglob("__init__.py")) deleted = [] kept = [] for init_file in inits: if ".venv" in init_file.parts or "node_modules" in init_file.parts: continue content = init_file.read_text().strip() if not content: init_file.unlink() deleted.append(str(init_file.relative_to(backend_dir))) else: kept.append((str(init_file.relative_to(backend_dir)), content)) print("Deleted empty __init__.py files:") for d in deleted: print(f" - {d}") print("\nKept __init__.py files (has content):") for k, c in kept: print(f" - {k}")