Tweets from pichat
| Two songs from the year I created my first web sites. http://t.co/8eHrOA9K + http://t.co/AuWb2etI #video #retro About 1 day ago from pichat (Mark Seuffert) |
Tweets from 600infos
| I HAVE NYANED FOR 888.4 SECONDS! http://t.co/JQYOZebv via @nyannyancat About 1 week, 5 days ago from 600infos (Wolf) |
Trace: » Quellcodes for Installer » FR1007 - clickable-links » FR1014 - increase WelcomeMotdMax » FR3001 Unicode » FR1017 - who-am-i » zip-to-7z.cmd
You are here: Pichat Wiki (en) » Snippets » zip-to-7z.cmd
zip-to-7z.cmd
Converting a ZIP-File to a more compressed 7z-File using 7z.exe and a little script in 3 steps
- extract the archiv in a temp folder
- compress the data again with maximum compression
- comparing the old and new filesize, if the size is smaler the zip will be deleted
- zip-to-7z.cmd
@echo.off Rem ############################################################################ Rem # Rem # SCRIPT: zip-to-7z.cmd Rem # Rem # converts all zip files to 7z in a directory Rem # if the 7z file is smaler the zip file will be deleted Rem # Rem # usage: copy the file in the directory and start it Rem # Rem # Version 0.0.2 Mark Wolfgruber 30.04.2010 Rem # Rem ############################################################################ echo.%date% %time% ### START SCRIPT %0 set _zip=c:\Progra~1\7-Zip\7z.exe if not exist %_zip% ( echo.ERROR: 7z.exe in %_zip% not found, Script aborted goto end ) for %%A in (*.zip) do ( echo.%date% %time% prozessing %a ... if exist %%~nA.7z del %%~nA.7z md %%~nA.script.tmp if exist %%~nA.script.tmp\. ( cd %%~nA.script.tmp %_zip% e ..\%%~nA.zip if exist *.* ( %_zip% a -mx9 -mmt -t7z ..\%%~nA.7z * cd .. del /s /q %%~nA\* rd %%~nA.script.tmp ) call :verify_size %%~nA rem pause rem if exist %%~nA.7z del %%~nA.zip ) else ( echo.ERROR: can not create temp subdirectory, Script aborted goto end ) ) goto end ::functions :verify_size SETLOCAL ENABLEDELAYEDEXPANSION for %%B in (%~n1.zip) do ( set _size[zip]=%%~zB set _file[zip]=%%~nxB ) for %%B in (%~n1.7z) do ( set _size[7z]=%%~zB set _file[7z]=%%~nxB ) if exist %_file[zip]% ( if exist %_file[7z]% ( if %_size[zip]% LSS %_size[7z]% ( echo.ALERT: zip is smaller than 7z, will not delete the ZIP-file %_file[zip]% ) else ( del %_file[zip]% ) ) else ( echo.%_file[7z]% does not exist ) ) else ( echo.%_file[zip]% does not exist ) ENDLOCAL goto :EOF :end echo.%date% %time% ### END SCRIPT %0 pause exit 0