@ECHO OFF CLS REM ================================================= REM Please Change Name and Path for the Following Variables REM ================================================= SET ZipExe=C:\PROGRA~1\WinZip\WZZIP.EXE SET RARExe=C:\PROGRA~1\WinRAR\RAR.EXE SET NFOFile=RoORS.NFO SET FILEID=File_ID.DIZ REM ================================================= IF NOT EXIST %NFOFile% goto NONFO IF NOT EXIST %FILEID% goto NODIZ IF "%1"=="" goto USAGEINFO IF "%2"=="" goto USAGEINFO set /a zipf=0 IF "%4"=="ABORT" ( FOR %%Z in (%1??.ZIP) DO ( GOTO ZIPSFOUND ) ) ELSE ( Del /Q "%1??.zip" Echo Delete "%1??.zip" ) Echo Delete "%1.part??.rar" (they should not be there though) DEL /Q "%1.part??.rar" REM ================================================= REM use "rn" instead of "a" to move files into the archive REM -v98078k creates volumes of a bit less than 100 MB REM to fit on a ZIP-100 disk REM -m5 sets the compression level. 5 is maximum, REM you can also set it to 0,1 .. 4 which is faster Echo Create RAR Archives %1.partXX.RAR for Data Selection %2 %RARExe% a -v98078k -m5 "%1" "%2" REM ================================================= Echo Rename %1.partXX.RAR to %1xx.RAR set /a pos=0 For /f %%x in ('dir /on /b "%1.part*.rar"') do ( set /a pos+=1 ) if %pos%==0 goto NORAR For /L %%n in (1,1,%pos%) do ( if %%n leq 9 (call :RenRAR %1 0%%n ) else (call :RenRAR %1 %%n ) ) Echo. Echo ================================================= Echo %pos% RAR volumes were created! Echo Please make now the necessary adjustments to your Echo NFO file and File_ID.DIZ files, Echo When you are done with it and ready to create the Echo ZIP release files.... echo. pause REM ================================================= Echo Build List of RAR Archives in Folder... dir /B /A:-D *.RAR >!RARFiles.txt REM ================================================= Echo Process RAR Archives... FOR /F "delims=|" %%i IN (!RARFiles.txt) DO ( Echo Processing %%i IF EXIST "%%i.ZIP" del "%%i.ZIP" %ZipExe% -a "%%i.ZIP" "%%i" IF EXIST "%NFOFile%" %ZipExe% -a "%%i.ZIP" "%NFOFile%" IF EXIST "%FILEID%" %ZipExe% -a "%%i.ZIP" "%FILEID%" IF NOT "%3" == "KEEPRAR" (DEL /Q "%%i") ) REM ================================================= Echo Build List of TEMP ZIP Files... Dir /b *.RAR.ZIP>!ZIPfiles.txt REM ================================================= Echo Rename ZIP Files... REM ================================================= FOR /F "delims=." %%i IN (!ZIPfiles.txt) DO ( Echo Rename %%i.RAR.ZIP to %%i.ZIP IF EXIST "%%i.ZIP" del "%%i.ZIP" REN "%%i.RAR.ZIP" "%%i.ZIP" ) REM ================================================= Echo Deleting TEMP Files... IF EXIST !ZIPfiles.txt Del /Q !ZIPfiles.txt IF EXIST !RARfiles.txt Del /Q !RARfiles.txt ECHO ================================================= ECHO Done! ECHO ================================================= Echo. Pause goto END REM ================================================= :USAGEINFO Echo. Echo Usage: Echo !ProcRel.bat BASEFILENAME InputData (KEEPRAR/DELRAR) (ABORT/OVERWRITE) Echo. Echo The parameter pairs #3: KEEPRAR / DELRAR and #4: ABORT/OVERWRITE are optional. Echo If you want to toggle parameter #4, parameter #3 must be specfied as well (DOS batch limitation) Echo The default behavior is DELRAR, which means that the RAR archives will be deleted, Echo once they were copied into the release ZIP archive file and OVERWRITE, which means that Echo the script deletes any ZIP files that exist in the directory with the same name as the release ZIP is going to be. Echo. Echo If you want to keep the copy of the RAR archive in addition to the release ZIPs or if you want Echo the script to abort, if it detects an existing ZIP file with the same name as the script intends to create Echo then you have to set the parameters, Echo. Echo They are also case sensitive! If they are misspelled, the default behavior will be triggered. Echo Example: Echo !ProcRel.bat X-RELN C:\RELN\*.* Echo. Echo !ProcRel.bat X-RELN C:\RELN\*.* KEEPRAR ABORT goto END REM ================================================= :NORAR echo. Echo Error! echo Error! No RAR Archives with the file names echo %1.partXX.RAR echo were Created! goto END REM ================================================= :NONFO echo. Echo Error! echo NFO-File %NFOFile% not found! goto END REM ================================================= :NODIZ echo. Echo Error! echo File_ID.DIZ file at %FILEID% not found! goto END REM ================================================= :ZIPSFOUND echo. Echo Error! (ABORT Parameter specified) Echo Current directory contains already one or more ZIP files Echo with the name: %1??.ZIP goto END REM ================================================= :RenRAR IF EXIST "%1.part%2.rar" ren "%1.part%2.rar" "%1%2.RAR" echo ren "%1.part%2.rar" "%1%2.RAR" REM ================================================= :END REM Finished! Echo. Goto :eof