Created
July 18, 2018 13:02
-
-
Save r3code/08d253b5c87e724b70baed303d2933fb to your computer and use it in GitHub Desktop.
Windows batch script to pack by 7z the source code files of my project excluding some folders or files by regexp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
echo Pack project sources to archive. | |
:SetVars | |
set SCRIPT_DIR=%~dp0 | |
IF %SCRIPT_DIR:~-1%==\ set SCRIPT_DIR=%SCRIPT_DIR:~0,-1% | |
rem Must be installed system wide or placed in the same folder | |
SET ZIP_TOOL=7z | |
SET PROJECT_NAME=MyApp | |
:Compress | |
set ARCHIVE_NAME=!PROJECT_NAME!-src.zip | |
if exist "!ARCHIVE_NAME!" ( | |
echo Remove previously created archive | |
del /F /Q "!ARCHIVE_NAME!" | |
) | |
echo. | |
echo Compress... | |
pu | |
!ZIP_TOOL! a -tzip "%SCRIPT_DIR%\!ARCHIVE_NAME!" "%SCRIPT_DIR%\*" -xr^^!.svn -xr^^!Doc -xr^^!*MiddleTest\python27.zip -xr^^!*.exe | |
if errorlevel 0 ( | |
echo Compress: OK. | |
echo: | |
echo Get you archive here: `%SCRIPT_DIR%\!ARCHIVE_NAME!` | |
exit /b 0 | |
) | |
echo Compress: [ERROR] Code !errorlevel!. | |
exit /b !errorlevel! | |
exit /b 0 | |
rem ====================================================================== | |
rem SUB PROGRAMS | |
rem ====================================================================== | |
:: no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment