@echo off echo. echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- echo gzip tool comparison utility - by Helder Magalhaes (2008-04-22) echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- :: check for source files if not exist source goto missingSource set UTILITY_NAME=7-zip echo. echo. echo Compress using %UTILITY_NAME%... :: check if it's available 7z -h >nul if errorlevel 1 goto missingTool :: check if target directory already exists if exist %UTILITY_NAME% rmdir /s %UTILITY_NAME% :: create target directory if necessary if not exist %UTILITY_NAME% mkdir %UTILITY_NAME% for %%i in (source\*.svg) do ( 7z a -tgzip %UTILITY_NAME%\%%~ni.svgz %%i -mx=9 -mfb=258 -mpass=15 ) set UTILITY_NAME=gzip echo. echo. echo Compress using %UTILITY_NAME%... :: check if it's available %UTILITY_NAME% -h >nul if errorlevel 1 goto missingTool :: check if target directory already exists if exist %UTILITY_NAME% rmdir /s %UTILITY_NAME% :: create target directory if necessary if not exist %UTILITY_NAME% mkdir %UTILITY_NAME% for %%i in (source\*.svg) do ( %UTILITY_NAME% --best --no-name --keep %%i ) :: NOTE: probably there's a better way to do this (most likely using gzip's switches) move source\*.gz %UTILITY_NAME%\ ren %UTILITY_NAME%\*.gz *. ren %UTILITY_NAME%\* *.svgz :: all OK - skip error cases goto end :missingSource echo. echo Missing test file set echo * Please put some test files into a directory named "source" goto end :missingTool echo. echo Missing %UTILITY_NAME%! Possible issues: echo * Tool not available - get it from: :: NOTE: this currently works by accident - probably needs to be changed if adding other tools! echo "http://www.%UTILITY_NAME%.org/" echo * Not in path variable - add tool's directory to: echo "Control Panel", "System", "Advanced" tab, "Environment Variables" button) goto end :end ::give user a chance to read output - useful for running the script within Windows Explorer echo. pause