DsL commited on
Commit ·
8923783
1
Parent(s): a225951
Remove local helper dirs from remote, keep local copies
Browse files- zip_scene.py +0 -37
zip_scene.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import zipfile
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
|
| 5 |
-
def zip_folder(folder_path, output_path):
|
| 6 |
-
"""
|
| 7 |
-
压缩单个文件夹
|
| 8 |
-
"""
|
| 9 |
-
folder = Path(folder_path)
|
| 10 |
-
with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
| 11 |
-
for file in folder.rglob('*'):
|
| 12 |
-
zipf.write(file, file.relative_to(folder.parent))
|
| 13 |
-
print(f"✅ Zipped {folder} -> {output_path}")
|
| 14 |
-
|
| 15 |
-
def zip_all_scenes(root_dir):
|
| 16 |
-
"""
|
| 17 |
-
扫描 Real, Hypothetical, Multi_View 文件夹,自动打包每个 scene
|
| 18 |
-
"""
|
| 19 |
-
root = Path(root_dir)
|
| 20 |
-
categories = ["Real", "Hypothetical", "Multi_View"]
|
| 21 |
-
|
| 22 |
-
for category in categories:
|
| 23 |
-
category_path = root / category
|
| 24 |
-
if not category_path.exists():
|
| 25 |
-
print(f"⚠️ Skip {category}: not found")
|
| 26 |
-
continue
|
| 27 |
-
|
| 28 |
-
for scene in category_path.iterdir():
|
| 29 |
-
if scene.is_dir():
|
| 30 |
-
output_zip = root / f"{category}_{scene.name}.zip"
|
| 31 |
-
zip_folder(scene, output_zip)
|
| 32 |
-
|
| 33 |
-
if __name__ == "__main__":
|
| 34 |
-
# 修改为你的根目录
|
| 35 |
-
zip_all_scenes(".")
|
| 36 |
-
|
| 37 |
-
print("✅ All scenes zipped successfully.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|