2622 채점자료 업데이트

This commit is contained in:
2026-02-11 16:06:09 +09:00
parent 28c0a9c4e1
commit e3cf4ea53f
40 changed files with 4402 additions and 816 deletions

View File

@@ -3,11 +3,11 @@ import shutil
from pathlib import Path
import re
# 채점자료 정답 파일만 복사하는 스크립트
# 회차별채점자료/회차명 폴더안 정답 파일만 복사하는 스크립트
# ===== 사용자 설정 =====
source_dir = r"D:\project\HWP\HWP-Scoring\회차별채점자료\2601"
exam_round = "2601" # 회차명
source_dir = r"D:\project\HWP\HWP-Scoring\회차별채점자료\2622"
exam_round = "2622" # 회차명
exam_code = "DIW" # 코드명
# =======================
@@ -16,8 +16,9 @@ def get_exam_type(filename: str):
"""
파일명에서 확장자 앞의 마지막 알파벳을 추출 (예: 국어A.hwpx → A)
"""
match = re.search(r"([A-Za-z])\.hwpx$", filename)
return match.group(1).upper() if match else None
# match = re.search(r"([A-Za-z])\.hwpx$", filename)
match = re.search(r'[A-Za-z](?=[^A-Za-z]*\.[^.]*$)', filename)
return match.group().upper() if match else None
def copy_exam_files():
@@ -30,14 +31,14 @@ def copy_exam_files():
copied = 0
for path in src.rglob("*"):
if path.is_file() and path.suffix.lower() == ".hwpx":
if path.is_file() and path.suffix.lower() == ".hwpx" and "정답" in path.name:
exam_type = get_exam_type(path.name)
if not exam_type:
continue # 마지막 문자가 알파벳이 아니면 건너뜀
dest_dir = base_dest / exam_type / exam_code
dest_dir.mkdir(parents=True, exist_ok=True)
dest_path = dest_dir / path.name
dest_path = dest_dir / f"DIW_{exam_round}{exam_type}.hwpx"
# 같은 이름의 파일이 있을 경우 숫자 붙이기
counter = 1