File size: 637 Bytes
ed552fd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/usr/bin/env python3
"""用干净模板覆盖所有 stokes_wave case 的 controlDict"""
import os, shutil
raw = '/mnt/f/agent-workspace/paper2/Exp/data/raw/stokes_wave'
template = '/mnt/f/agent-workspace/paper2/Exp/data/scripts/stokes_controlDict_template'
with open(template) as f:
tmpl = f.read()
fixed = 0
for d in sorted(os.listdir(raw)):
if not d.startswith('t'):
continue
cd = os.path.join(raw, d, 'system', 'controlDict')
if os.path.isdir(os.path.dirname(cd)):
with open(cd, 'w') as f:
f.write(tmpl)
fixed += 1
print(f'Overwrote {fixed} controlDicts with clean template')
|