Files
cat/01_copy_files_answer.py

45 lines
1.6 KiB
Python
Raw Normal View History

2026-04-02 15:27:30 +09:00
import os
import shutil
# ── 설정 ────────────────────────────────────────────────────────────────
exam_round = "2603"
source_dir = rf"D:\project\Entry\Entry-Scoring\시험자료\{exam_round}"
output_base = r"ent"
# 급수 → 코드 매핑
grade_code_map = {
"3급": "CAT_3",
"2급": "CAS_2",
}
grades = ["3급", "2급"]
types = ["A", "B", "C"]
# ── 복사 실행 ────────────────────────────────────────────────────────────
for grade in grades:
grade_code = grade_code_map[grade]
for type in types:
# 원본 파일명 고정
src_filename = f"{exam_round}회 코딩활용능력 {grade} {type}형 정답.ent"
src_path = os.path.join(source_dir, src_filename)
if not os.path.exists(src_path):
print(f"[WARN] 파일 없음: {src_path}")
continue
# exam_name: 2603_CAT_3_A
exam_name = f"{exam_round}_{grade_code}_{type}"
# 대상 경로: ent\2603_CAT_3_A
dst_folder = os.path.join(output_base, exam_name)
os.makedirs(dst_folder, exist_ok=True)
# 변경된 파일명: 2603_CAT_3_A_정답.ent
dst_filename = f"{exam_name}_정답.ent"
dst_path = os.path.join(dst_folder, dst_filename)
shutil.copy2(src_path, dst_path)
print(f"[OK] 복사 완료: {src_path}{dst_path}")
print("\n전체 처리 완료.")