Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- REM zip_to_7zip_subfolders.bat - find all .zip, .rar and 7z files in the current directory and all subfolders, recompress them into zip files - but don't delete the originals.
- set RootDir=%CD%
- set OutputDir="d:\TMP\try\SomeFolder"
- set ArchiverDir="e:\Program Files\7-Zip\7z"
- ECHO Searching for RAR and ZIP files to recompress into 7zip archives.
- for /R "%RootDir%" %%F in (*.rar *.zip *.7z) do (
- ECHO Found %%F to recompress...
- REM Extract...
- %ArchiverDir% x "%%F" -o"%TEMP%\_manga\%%F contents"
- REM Does the directory exist? has 7zip created it correctly?
- IF EXIST "%%~fF contents" (
- REM Change directory, create 7zip of contents of directory...
- CD "%%~fF contents"
- %ArchiverDir% a -t7z "%OutputDir%\%%~nF.7z" * -mx=9
- CD "%RootDir%"
- REM Delete the temporary extraction folder
- RMDIR "%TEMP%\_manga\%%~fF contents" /S /Q
- ECHO Recompressed %%F to %%~nF.7z
- )
- )
- ECHO Search ended.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement