Files
2nd/scratch/find_empty_templates.py

34 lines
1.1 KiB
Python

import os
import re
base_path = r'E:\Wiki\2nd\10_Wiki\Topics'
empty_files = []
def is_empty_template(content):
# Check if Summary section is basically empty
summary_match = re.search(r'## 📌 한 줄 통찰 \(The Karpathy Summary\)\n>\s*\n', content)
# Check if Content section is basically empty
content_match = re.search(r'## 📖 구조화된 지식 \(Synthesized Content\)\s*## ⚠️ 모순', content, re.DOTALL)
if summary_match and content_match:
return True
return False
for root, dirs, files in os.walk(base_path):
for f in files:
if f.endswith('.md'):
file_path = os.path.join(root, f)
if len(file_path) > 240: continue
try:
with open(file_path, 'r', encoding='utf-8', errors='ignore') as f_obj:
content = f_obj.read()
if is_empty_template(content):
empty_files.append(file_path)
except:
pass
print(f"Found {len(empty_files)} empty template files.")
for f in empty_files[:50]:
print(f"{f}")