From 3075f9b559d072b735a0585213ebe8be76292488 Mon Sep 17 00:00:00 2001 From: antonov Date: Wed, 5 Aug 2026 21:28:43 +0300 Subject: [PATCH] Add Windows CMD script --- git-mirror-zip.bat | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 git-mirror-zip.bat diff --git a/git-mirror-zip.bat b/git-mirror-zip.bat new file mode 100644 index 0000000..aec9042 --- /dev/null +++ b/git-mirror-zip.bat @@ -0,0 +1,30 @@ +@echo off +setlocal enabledelayedexpansion +:: Clone a git repo as a full mirror and pack it into a zip archive. +:: Works on Windows (PowerShell 5.0+). + +if "%~1"=="" ( + echo Usage: %~nx0 ^ [output.zip] + exit /b 1 +) + +set "URL=%~1" +set "OUT=%~2" +if "!OUT!"=="" set "OUT=repo.zip" +set "WORK_DIR=.tmp_git_mirror" + +echo [1/3] Cloning mirror of %URL% ... +git clone --mirror "%URL%" "%WORK_DIR%" +if errorlevel 1 ( + echo Git clone failed. + rmdir /s /q "%WORK_DIR%" >nul 2>&1 + exit /b 1 +) + +echo [2/3] Creating %OUT% with maximum compression ... +powershell -NoProfile -Command ^ + "Compress-Archive -Path '%WORK_DIR%\*' -DestinationPath '%OUT%' -CompressionLevel Optimal -Force" + +echo [3/3] Done: %OUT% + +rmdir /s /q "%WORK_DIR%" >nul 2>&1