chore: cleanup 0-byte md files, placeholders, and redundant nested directories in 10_Wiki

This commit is contained in:
2026-04-27 18:08:08 +09:00
parent 4e52a7c2b5
commit 975cadbb48
32 changed files with 101 additions and 810 deletions
+38
View File
@@ -0,0 +1,38 @@
import os
import shutil
base_path = r'E:\Wiki\2nd\10_Wiki'
canned_phrases = [
"I'm now integrating",
"Analyzing the",
"I'm also incorporating",
"I've expanded my view",
"I'm currently noting",
"I'm currently drafting",
"I'm noting casino-like tactics"
]
deleted_files = []
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:
if os.path.getsize(file_path) == 0:
os.remove(file_path)
deleted_files.append(file_path)
continue
with open(file_path, 'r', encoding='utf-8', errors='ignore') as f_obj:
content = f_obj.read(1000)
if any(phrase in content for phrase in canned_phrases):
f_obj.close() # Explicitly close
os.remove(file_path)
deleted_files.append(file_path)
except Exception as e:
print(f"Error on {f}: {e}")
print(f"Deleted {len(deleted_files)} canned files.")