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 = { "Skybound_Reports": [], "Balancing": [], "Core_Systems": [], "Economy": [], "Level_Design": [], "UX_Scenarios": [], "Theory_and_Principles": [] } # Create folders if they don't exist for folder in folders.keys(): path = os.path.join(gd_root, folder) if not os.path.exists(path): os.makedirs(path) # Classification Rules (Regex/Keywords) rules = [ (r"2026-|Skybound", "Skybound_Reports"), (r"Monetization|VIP|수익화|Whales|Revenue|Currency|BM|가상 화폐|맞춤형 팩|고과금", "Economy"), (r"Balancing|Pass|Curve|Rebalance|Counter|Matchup|상성", "Balancing"), (r"AI|Combat|Controls|Physics|Simulation|Systems|Armor|Damage|Unit|전투|제어|컨트롤|Pursuit|Pursuit", "Core_Systems"), (r"Level|Design|Map|Layout|World|거점|섹터", "Level_Design"), (r"UX|Scenario|HUD|UI|Interface|번역|RTE", "UX_Scenarios"), (r"Theory|Philosophy|Agency|Autonomy|Principles|Post-Modernist|Literature|Systems Biology", "Theory_and_Principles") ] def classify(filename): for pattern, folder in rules: if re.search(pattern, filename, re.IGNORECASE): return folder return None # Process files in gd_root (not recursive) 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: dest_path = os.path.join(gd_root, target_folder, item) print(f"Moving {item} -> {target_folder}") shutil.move(item_path, dest_path) else: print(f"Skipping {item} (No match)") print("Wiki-fication (Classification) Complete.")