# -*- coding: utf-8 -*- import os, io, json ROOT=r"D:\01.프로젝트\DB수집" SKIP_DIR={"_backup","backup","_temp","_스크립트","_nshots","_naudit","_shots",".git","_gnb","__pycache__"} def skipname(b): bl=b.lower() if b.startswith("~$"): return True if "backup" in bl or "conflicted" in bl: return True for s in ("_작업현황","작업현황","_취합","취합본","예시","자료_취합","교육청_작업현황"): if s in b: return True return b.startswith("_") work=[]; sub=[]; other=[] for dp,dn,fn in os.walk(ROOT): dn[:]=[d for d in dn if d not in SKIP_DIR and "backup" not in d.lower()] for f in fn: if not f.endswith(".xlsx"): continue if skipname(f): continue p=os.path.join(dp,f) rel=os.path.relpath(p,ROOT) if "제출폴더" in rel: sub.append(rel) elif "참고파일" in rel: other.append(rel) else: work.append(rel) io.open(r"D:\01.프로젝트\DB수집\작업파일\_targets.json","w",encoding="utf-8").write(json.dumps({"work":work,"sub":sub,"other":other},ensure_ascii=False,indent=0)) print("WORK",len(work),"SUB",len(sub),"OTHER",len(other)) print("\n--- WORK (기존문서) ---") for x in work: print(" ",x)