ChangE-3 / move_depth_files.py
LuMonDepth's picture
Add files using upload-large-folder tool
9fec5ed verified
#!/usr/bin/env python3
"""Collect .npy files from pair1..pair168 into ./depth as 3-digit names."""
from __future__ import annotations
import shutil
from pathlib import Path
def main() -> None:
root = Path(__file__).resolve().parent
dest_dir = root / "depth"
dest_dir.mkdir(exist_ok=True)
for idx in range(1, 169):
pair_dir = root / f"pair{idx}"
if not pair_dir.is_dir():
print(f"[skip] {pair_dir.name} not found")
continue
npy_files = list(pair_dir.glob("*.npy"))
if not npy_files:
print(f"[skip] no .npy in {pair_dir.name}")
continue
if len(npy_files) > 1:
print(f"[warn] multiple .npy in {pair_dir.name}; using first: {npy_files[0].name}")
source = npy_files[0]
target = dest_dir / f"{idx:03d}.npy"
# Move to avoid duplicates in source folders. Change to copy2 if you prefer copying.
shutil.move(str(source), target)
print(f"[ok] {pair_dir.name} -> {target.name}")
print(f"Done. Files gathered in {dest_dir}")
if __name__ == "__main__":
main()