Decompress Zip and recompress 7zip with Recursive Directory
Posted: 22 Nov 2011 03:21
Hello,
I using two script for decompress ZIP file and re-compress using 7zip
The particularity of this script is that are inside Zip another zip file the batch recursively unzip all file and after compress all using 7Zip utility.
This is the 1st script Zip_to_7z.bat
and this is the 2st script Zip_to_7z_recursive.bat
I run it with command
E:\test\Script\Zip_to_7z E:\test\directory_with_zip_inside
The question is, this script are written correctly, or have I made mistakes that can be adjust?
Regards
Dario
I using two script for decompress ZIP file and re-compress using 7zip
The particularity of this script is that are inside Zip another zip file the batch recursively unzip all file and after compress all using 7Zip utility.
This is the 1st script Zip_to_7z.bat
Code: Select all
@echo off&setlocal enabledelayedexpansion
SET SevenZip=7za a -t7z -m0=LZMA -mx9 -mmt=2
set directory=%1
cd %directory%
for /f "delims=" %%p in (
'DIR /b *.zip'
) do (
wzunzip -o "%%~dpnxp" "%%~dpnp" > nul
cmd /c E:\test\Script\Zip_to_7z_recursive.bat "%%~np"
%SevenZip% "%%~dpnp.7z" "%%~dpnp\*"
rd /s /q "%%~np"
del /q "%%~nxp"
)
and this is the 2st script Zip_to_7z_recursive.bat
Code: Select all
@echo off&setlocal enabledelayedexpansion
set directory=%1
cd %directory%
for /f "delims=" %%q in (
'DIR /b *.zip'
) do (
wzunzip -o "%%~dpnxq" "%%~dpnq" > nul
cmd /c E:\test\Script\Zip_to_7z_recursive.bat "%%~nq"
del /q "%%~nxq"
)
I run it with command
E:\test\Script\Zip_to_7z E:\test\directory_with_zip_inside
The question is, this script are written correctly, or have I made mistakes that can be adjust?
Regards
Dario