from pathlib import Path import shutil folder=Path(__file__).parent for root in (Path('C:/wechat_rpa'),Path('C:/kefu/wechat_rpa')): target=root/'reply_session_policy.py' if target.exists(): backup=root/'backups/skip-sessions-20260917/reply_session_policy.py' backup.parent.mkdir(parents=True,exist_ok=True) if not backup.exists():shutil.copy2(target,backup) target.write_text((folder/'reply_session_policy.py').read_text(encoding='utf-8'),encoding='utf-8')