import os import shutil import re wiki_root = r"E:\Wiki\2nd\10_Wiki" gd_root = os.path.join(wiki_root, "Topics_GD") # Target subdirectories folders = { "Economy": ["BM", "수익화", "가상 화폐", "고과금", "고래", "적자 경제", "Staircase", "Monetization", "Market", "Revenue"], "Balancing": ["밸런스", "상성", "데미지", "Counter", "Matchup", "Pass", "Curve", "Rebalance"], "Core_Systems": ["전투", "제어", "컨트롤", "로직", "시스템", "Architecture", "Simulation", "Pursuit", "AI", "Physics"], "Level_Design": ["레이아웃", "방어 설계", "기지", "월드 맵", "거점", "섹터", "Area", "Zone", "Map", "Layout"], "UX_Scenarios": ["UX", "Scenario", "HUD", "UI", "Interface", "번역", "RTE"], "Theory_and_Principles": ["Theory", "Principles", "Agency", "Autonomy", "Philosophy", "Post-Modernist"] } def classify(filename): for folder, keywords in folders.items(): for kw in keywords: if kw.lower() in filename.lower(): return folder return None # Second pass for remaining files in gd_root for item in os.listdir(gd_root): item_path = os.path.join(gd_root, item) if os.path.isfile(item_path) and item.endswith(".md") and item != "Index.md": target_folder = classify(item) if target_folder: target_path = os.path.join(gd_root, target_folder) if not os.path.exists(target_path): os.makedirs(target_path) dest_path = os.path.join(target_path, item) print(f"Moving {item} -> {target_folder}") shutil.move(item_path, dest_path) print("Second pass complete.")