From 998d4dbd277e86cd4e981178dacb804a615cb4d5 Mon Sep 17 00:00:00 2001 From: Shuming Liu Date: Mon, 6 Apr 2026 11:12:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/file_association.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/server/file_association.py b/server/file_association.py index 708093c..f5fcf45 100644 --- a/server/file_association.py +++ b/server/file_association.py @@ -475,6 +475,8 @@ def main(): # 移动文件夹到 data 目录 extract_dir = data_dir / folder.name shutil.move(str(folder), str(extract_dir)) + # 更新 folder 变量,避免后续移动时路径不正确 + folder = extract_dir # 查找 Word 文档 word_doc = find_word_doc_recursive(extract_dir) @@ -500,26 +502,29 @@ def main(): if not zxxk_folder.exists(): print("❌ 文件夹不存在,请先解压文件") - # 将失败的文件拷贝到本程序所在目录的 ee 子目录 + # 将失败的文件移动到本程序所在目录的 ee 子目录 script_dir = Path(__file__).parent ee_dir = script_dir / "ee" ee_dir.mkdir(exist_ok=True) dest_file = ee_dir / folder.name - shutil.copy2(folder, dest_file) - print(f" 已拷贝失败文件到:{dest_file}") + shutil.move(str(folder), str(dest_file)) + print(f" 已移动失败文件到:{dest_file}") fail_count += 1 continue if not twole_folder.exists(): twole_folder = base_dir / "二一教育" + if not twole_folder.exists(): + twole_folder = base_dir / "21世纪教育" if not twole_folder.exists(): print("❌ 文件夹不存在,请先解压文件") - # 将失败的文件拷贝到本程序所在目录的 ee 子目录 + # 将失败的文件移动到本程序所在目录的 ee 子目录 script_dir = Path(__file__).parent ee_dir = script_dir / "ee" ee_dir.mkdir(exist_ok=True) - dest_file = ee_dir / folder.name - shutil.copy2(folder, dest_file) - print(f" 已拷贝失败文件到:{dest_file}") + dest_file = ee_dir + print(str(folder), str(dest_file)) + shutil.move(str(folder), str(dest_file)) + print(f" 已移动失败文件到:{dest_file}") fail_count += 1 continue