from pathlib import Path import shutil root = Path.home() / "Projects" for git_dir in root.rglob(".git"): if git_dir.is_dir(): print(f"Удаляю: {git_dir}") shutil.rmtree(git_dir)