Skip to content

Instantly share code, notes, and snippets.

@niro1987
Created December 16, 2021 13:46
Show Gist options
  • Save niro1987/b89677f96d15d6fb4e0cbb3ba6c802c0 to your computer and use it in GitHub Desktop.
Save niro1987/b89677f96d15d6fb4e0cbb3ba6c802c0 to your computer and use it in GitHub Desktop.
Windows ZipMyFiles
@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