AlanZee's picture
Upload folder using huggingface_hub
ed552fd verified
Raw
History Blame Contribute Delete
1.08 kB
#!/usr/bin/env python3
"""清理 raw/ 下所有 case 的中间时间步、log、processor、postProcessing,
只保留 0/ constant/ system/ Allrun Allclean(初始条件和配置)"""
import os, shutil
raw = '/mnt/f/agent-workspace/paper2/Exp/data/raw'
keep = {'0', 'constant', 'system', 'Allrun', 'Allclean'}
total_removed = 0
for ct in sorted(os.listdir(raw)):
ct_dir = os.path.join(raw, ct)
if not os.path.isdir(ct_dir):
continue
for case in sorted(os.listdir(ct_dir)):
case_dir = os.path.join(ct_dir, case)
if not os.path.isdir(case_dir):
continue
for entry in os.listdir(case_dir):
if entry in keep:
continue
path = os.path.join(case_dir, entry)
try:
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.remove(path)
total_removed += 1
except Exception as e:
print(f' WARN: {path}: {e}')
print(f'Cleaned {total_removed} entries from {raw}')