| |
| from __future__ import annotations |
|
|
| import argparse |
| import shutil |
| from pathlib import Path |
|
|
|
|
| def move_group(src_dir: Path, pattern: str, dst_dir: Path) -> int: |
| dst_dir.mkdir(parents=True, exist_ok=True) |
| moved = 0 |
| for p in src_dir.glob(pattern): |
| if not p.is_file(): |
| continue |
| target = dst_dir / p.name |
| shutil.move(str(p), str(target)) |
| moved += 1 |
| return moved |
|
|
|
|
| def main() -> None: |
| parser = argparse.ArgumentParser( |
| description="Organize help_docs by moving *.help.txt and *.manual_bundle.txt into separate folders." |
| ) |
| parser.add_argument( |
| "--help-docs-dir", |
| type=str, |
| default="/225040511/project/BioScientist/agent_system/toolbase/output/help_docs", |
| help="Directory containing help_docs artifacts.", |
| ) |
| parser.add_argument( |
| "--help-subdir", |
| type=str, |
| default="help_txt", |
| help="Subdirectory name for *.help.txt files.", |
| ) |
| parser.add_argument( |
| "--manual-subdir", |
| type=str, |
| default="manual_bundle_txt", |
| help="Subdirectory name for *.manual_bundle.txt files.", |
| ) |
| args = parser.parse_args() |
|
|
| base = Path(args.help_docs_dir) |
| if not base.exists(): |
| raise FileNotFoundError(f"help_docs directory not found: {base}") |
|
|
| moved_help = move_group(base, "*.help.txt", base / args.help_subdir) |
| moved_manual = move_group(base, "*.manual_bundle.txt", base / args.manual_subdir) |
|
|
| print(f"moved_help_txt={moved_help}") |
| print(f"moved_manual_bundle_txt={moved_manual}") |
| print(f"help_txt_dir={base / args.help_subdir}") |
| print(f"manual_bundle_txt_dir={base / args.manual_subdir}") |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|
|
|