google_fonts / zip_folder.py
kargaranamir's picture
upload 03/2026
8c50d4f
raw
history blame contribute delete
756 Bytes
import os
import zipfile
from pathlib import Path
# Root folder containing ISO script directories
SOURCE_DIR = Path("fonts_data")
# Where the zip files will be stored
OUTPUT_DIR = Path("zipped_fonts")
OUTPUT_DIR.mkdir(exist_ok=True)
for script_dir in SOURCE_DIR.iterdir():
if script_dir.is_dir():
zip_path = OUTPUT_DIR / f"{script_dir.name}.zip"
print(f"Zipping {script_dir.name} -> {zip_path}")
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zipf:
for file in script_dir.rglob("*"):
if file.is_file():
# keep relative structure inside zip
arcname = file.relative_to(SOURCE_DIR)
zipf.write(file, arcname)
print("Done.")