Advertisement
otakuSiD

recompress

Sep 26th, 2011
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.91 KB | None
  1. @ECHO OFF
  2. 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.
  3. set RootDir=%CD%
  4. set OutputDir="d:\TMP\try\SomeFolder"
  5. set ArchiverDir="e:\Program Files\7-Zip\7z"
  6.  
  7. ECHO Searching for RAR and ZIP files to recompress into 7zip archives.
  8. for /R "%RootDir%" %%F in (*.rar *.zip *.7z) do (
  9.     ECHO Found %%F to recompress...
  10.     REM Extract...
  11.     %ArchiverDir% x "%%F" -o"%TEMP%\_manga\%%F contents"
  12.     REM Does the directory exist? has 7zip created it correctly?
  13.     IF EXIST "%%~fF contents" (
  14.         REM Change directory, create 7zip of contents of directory...
  15.         CD "%%~fF contents"
  16.         %ArchiverDir% a -t7z "%OutputDir%\%%~nF.7z" * -mx=9
  17.         CD "%RootDir%"
  18.         REM Delete the temporary extraction folder
  19.         RMDIR "%TEMP%\_manga\%%~fF contents" /S /Q
  20.         ECHO Recompressed %%F to %%~nF.7z
  21.     )
  22. )
  23.  
  24. ECHO Search ended.
  25.  
Advertisement
RAW Paste Data Copied
Advertisement