FinRAG-Agent/FinRAG-Pro
1
1"""2步骤1:重构目录结构3- 创建 reports/annual 和 reports/industry4- 将 data/raw 中所有公司年报文件移入 reports/annual5- 如果 data/raw 中有行业研报,移入 reports/industry6"""7 8import os9import shutil10import glob11 12BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))13 14ANNUAL_DIR = os.path.join(BASE, "reports", "annual")15INDUSTRY_DIR = os.path.join(BASE, "reports", "industry")16OLD_RAW_DIR = os.path.join(BASE, "data", "raw")17 18os.makedirs(ANNUAL_DIR, exist_ok=True)19os.makedirs(INDUSTRY_DIR, exist_ok=True)20 21print("=" * 60)22print(" 步骤1:重构目录结构")23print("=" * 60)24print()25print(f" reports/annual/ → {ANNUAL_DIR}")26print(f" reports/industry/ → {INDUSTRY_DIR}")27print()28 29# 获取所有TXT文件30all_files = sorted(glob.glob(os.path.join(OLD_RAW_DIR, "*.txt")))31print(f" 在 data/raw 下发现 {len(all_files)} 个文件")32print()33 34moved_count = 035industry_count = 036 37for f in all_files:38 fname = os.path.basename(f)39 # 判断:带"行业"或"互联网"的是行业研报40 if "行业" in fname or "互联网" in fname:41 dest = os.path.join(INDUSTRY_DIR, fname)42 shutil.move(f, dest)43 industry_count += 144 print(f" [行业研报] {fname} → reports/industry/")45 else:46 dest = os.path.join(ANNUAL_DIR, fname)47 shutil.move(f, dest)48 moved_count += 149 print(f" [官方年报] {fname} → reports/annual/")50 51print()52print(f" 移动完成: 年报 {moved_count} 份, 研报 {industry_count} 份")53print(f" data/raw 剩余: {len(glob.glob(os.path.join(OLD_RAW_DIR, '*')))} 个文件")54print()55print("✅ 步骤1完成")56 