Dec 5, 2016 05:57 PM
(This post was last modified: Dec 5, 2016 05:59 PM by final kaoss.)
This one is quick & easy, what it does find all .zip and .rar files in the current directory, recompress them into 7zip files and delete the originals.
Source
Source
Code
@ECHO OFF
REM zip_to_7zip_automated_delete.bat - find all .zip and .rar files in the current directory, recompress them into 7zip files and delete the originals. Skip ones that don't decompress.
ECHO Searching for RAR and ZIP files to recompress into 7zip archives.
for %%F in (*.rar *.zip) do (
ECHO Found %%F to recompress...
REM Extract...
"C:\Program Files\7-Zip\7z" x "%%F" -o"%%F contents"
REM Does the directory exist? has 7zip created it correctly?
IF EXIST "%%F contents" (
REM Change directory, create 7zip of contents of directory...
CD "%%F contents"
"C:\Program Files\7-Zip\7z" a -t7z "../%%~nF.7z" * -mx=9 0=bcj2 1=LZMA2:d128m:pb2:lp0:lc4:fb175 2=LZMA2:d19:pb2:lp0:lc4:fb175 3=LZMA2:d19:pb2:lp0:lc4:fb175 b0:1 b0s1:2 b0s2:3
CD ..
REM Delete the old files
DEL "%%F" /F /Q
RMDIR "%%F contents" /S /Q
ECHO Recompressed %%F to %%~nF.7z and deleted %%F.
)
)
ECHO Search ended.
pause
