MCPcopy Index your code
hub / github.com/cft0808/edict / cleanup_backups

Function cleanup_backups

scripts/apply_model_changes.py:26–34  ·  view source on GitHub ↗

只保留最近 MAX_BACKUPS 个备份

()

Source from the content-addressed store, hash-verified

24
25
26def cleanup_backups():
27 """只保留最近 MAX_BACKUPS 个备份"""
28 pattern = str(OPENCLAW_CFG.parent / 'openclaw.json.bak.model-*')
29 baks = sorted(glob.glob(pattern))
30 for old in baks[:-MAX_BACKUPS]:
31 try:
32 pathlib.Path(old).unlink()
33 except OSError:
34 pass
35
36
37def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected