1.

Solve : Build a better Batch file (for changing zip -> 7zip)?

Answer»

I have tons of zip files, and I've been trying to recompress them into 7zip to get some disk space back and I wrote two batch files with for loops to first extract from .zip then when it finishes, it deletes all the zips and does the next for loop for the extracted files into 7zip like so:
Code: [Select] for %%i in (*.zip) do 7z.exe E "%%~ni.zip" -y
del *.zip

----Second Batch ----
for %%i in (*.jpg) do 7z.exe a -t7z -mx9 -mmt "%%~ni.7z" "%%i.jpg"
del *.jpg
So, very basic, but I have a folder with nearly 10gbs of neatly zipped files, if I run this, it'll be zip (10gb) + file (10gb) and I don't know if I have enough room. What I want is to extract, then compress, then go to the next file, any help would be greatly APPRECIATED!Never mind, I got it:

Code: [Select]for %%i in (*.zip) do (
start /wait c:\"Program Files"\7-zip\7z.exe e "%%~ni.zip" -y
del "%%~ni.zip"
start /wait c:\"Program Files"\7-zip\7z.exe a -t7z -mx9 -mmt "%%~ni.7z" "%%~ni.jpg"
del "%%~ni.jpg"
)

It is a waste of time to compress jpg images in zip files, as jpg format files are already compressed and not much further compression is POSSIBLE. However it is good to hide PICTURES of BIKINI babes from Mom and Sis.



Discussion

No Comment Found