清理所有批次数据
(output_dir: str)
| 69 | print("📋 未找到进度文件") |
| 70 | |
| 71 | def clean_batches(output_dir: str): |
| 72 | """清理所有批次数据""" |
| 73 | batch_dirs = [d for d in os.listdir(output_dir) |
| 74 | if d.startswith("batch_") and os.path.isdir(os.path.join(output_dir, d))] |
| 75 | |
| 76 | if not batch_dirs: |
| 77 | print("📁 未找到批次数据") |
| 78 | return |
| 79 | |
| 80 | print(f"找到 {len(batch_dirs)} 个批次目录:") |
| 81 | for batch_dir in sorted(batch_dirs): |
| 82 | print(f" - {batch_dir}") |
| 83 | |
| 84 | confirm = input("\n⚠️ 确认要删除所有批次数据吗? (y/N): ").strip().lower() |
| 85 | if confirm == 'y': |
| 86 | import shutil |
| 87 | for batch_dir in batch_dirs: |
| 88 | batch_path = os.path.join(output_dir, batch_dir) |
| 89 | shutil.rmtree(batch_path) |
| 90 | print(f"🗑️ 已删除: {batch_dir}") |
| 91 | print("✅ 所有批次数据已清理") |
| 92 | else: |
| 93 | print("取消操作") |
| 94 | |
| 95 | def merge_batches(output_dir: str): |
| 96 | """手动合并所有批次数据""" |