검증 사본 미러 도구(Tools/mirror_verify.py) — Assets·Packages·ProjectSettings 바뀐 파일만 복사 · 없는 파일 삭제(UI 재설계 구현 이관용)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
깃 관리자 2026-11-09 10:48:38 +09:00
parent d73c606e46
commit 028b48cd9a
1 changed files with 31 additions and 0 deletions

31
Tools/mirror_verify.py Normal file
View File

@ -0,0 +1,31 @@
"""검증 사본 동기화 — 본체의 Assets · Packages · ProjectSettings 를 사본(기본 E:/Nerdnavis/_tks_verify)에 미러(바뀐 파일만 복사 · 본체에 없는 파일 삭제).
PD 에디터가 본체를 열고 있어도 사본에서 배치·GUI 캡처를 돌리기 위한 것(프로젝트 CLAUDE.md 「에디터가 열려 있을 때」 · robocopy 는 bash 에서 깨져 python 으로).
실행: <ComfyUI venv python> -I Tools/mirror_verify.py [본체] [사본]
"""
import os
import shutil
import sys
src = sys.argv[1] if len(sys.argv) > 1 else os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
dst = sys.argv[2] if len(sys.argv) > 2 else r"E:/Nerdnavis/_tks_verify"
cp = rm = 0
for top in ["Assets", "Packages", "ProjectSettings"]:
s0, d0 = os.path.join(src, top), os.path.join(dst, top)
for root, dirs, files in os.walk(s0):
dd = os.path.join(d0, os.path.relpath(root, s0))
os.makedirs(dd, exist_ok=True)
for f in files:
a, b = os.path.join(root, f), os.path.join(dd, f)
if not os.path.exists(b) or os.path.getsize(a) != os.path.getsize(b) or int(os.path.getmtime(a)) != int(os.path.getmtime(b)):
shutil.copy2(a, b)
cp += 1
for root, dirs, files in os.walk(d0, topdown=False):
sr = os.path.join(s0, os.path.relpath(root, d0))
for f in files:
if not os.path.exists(os.path.join(sr, f)):
os.remove(os.path.join(root, f))
rm += 1
if not os.path.exists(sr):
os.rmdir(root)
print("copied", cp, "removed", rm, "->", dst)