Created
December 16, 2021 13:46
-
-
Save niro1987/b89677f96d15d6fb4e0cbb3ba6c802c0 to your computer and use it in GitHub Desktop.
Windows ZipMyFiles
This file contains 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 | |
CLS | |
:Initialize | |
@REM Iterate over all files in the current folder | |
ECHO: | |
SET "_ME=%~f0" | |
SET "_7z=C:\Program Files\7-Zip\7z.exe" | |
IF NOT EXIST "%_7z%" ( | |
ECHO "You do not have 7-Zip installed." | |
GOTO :Terminate | |
) | |
FOR /r %%i IN (*) DO CALL :zipmyfile %%~fi | |
ECHO Done! | |
GOTO :Terminate | |
:zipmyfile | |
SET "_FILEPATH=%*" | |
IF /I NOT "%_ME%"=="%_FILEPATH%" ( | |
ECHO "%_FILEPATH%.gz" | |
"%_7z%" a -mx5 -tgzip -sse -aoa -sdel "%_FILEPATH%.gz" "%_FILEPATH%" | |
) | |
GOTO :EOF | |
:Terminate | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment