This is a quick update (and fix) for the Version 2.0 of the script that I released about 1 month ago. I wrote in detail about it here. It is basically a useful batch script with configuration INI file to RAR and then ZIP your scene releases, add NFO and File_ID.DIZ and optional INTRO to each Release File automatically. See ReadMe.txt, which is included in the Release ZIP of the script, for details and help. Download link can be found a little bit further below.
More Bug Fixes
- Version 2.0 of the script had a bug, if the release is only one RAR archive. This is fixed now. The script is able to handle single file releases as well as multi-file ones.
- I did some tweaking and testing that it is not necessary anymore to use the 8.3 DOS short paths neither for the specification of the RAR and ZIP executables locations nor for the path to the data folder where you have the files that go into your release.
I also included a FILE_ID.DIZ template in this version of the release, as reference.
Download
Roy-ProcessReleases21.ZIP (365 KB)
Important Disclaimer!
The author, of this software accepts no responsibility for damages resulting from the use of this product and makes no warranty or representation, either expressed or implied, including but not limited to, any implied warranty of merchantability or fitness for a particular purpose.
This software is provided "AS IS", and you, its user, assume all risks when using it.
Source Code
ProcRel2.bat
1: @ECHO OFF 2: CLS 3: REM Process Scene Releases V2.14: REM Batch Script by Roy/SAC (http://www.roysac.com/)
5: REM =================================================6: REM Please Change Name and Path for the Following Variables
7: REM ================================================= 8: SETLOCAL ENABLEDELAYEDEXPANSION 9: call:READINI SETTINGS ZipExe 10: call:READINI SETTINGS RARExe 11: call:READINI SETTINGS NFOFile 12: call:READINI SETTINGS FILEID 13: call:READINI SETTINGS INTROEXE 14: call:READINI SETTINGS BASEFILENAME 15: call:READINI SETTINGS RAROPT 16: call:READINI SETTINGS RARVOLSIZE 17: call:READINI SETTINGS RAREXTRA 18: call:READINI SETTINGS INPUTDATA 19: call:READINI SETTINGS RARFiles 20: call:READINI SETTINGS IFFILEEXISTS 21: Echo --------------------------------------------------------- 22: Echo ProcRel.INI Parameters 23: Echo --------------------------------------------------------- 24: Echo ZipExe=%ZipExe% 25: Echo RARExe=%RARExe% 26: Echo NFOFile=%NFOFile% 27: Echo FILEID=%FILEID% 28: Echo INTROEXE=%INTROEXE% 29: Echo BASEFILENAME=%BASEFILENAME% 30: Echo RAROPT=%RAROPT% 31: Echo RARVOLSIZE=%RARVOLSIZE% 32: Echo RAREXTRA=%RAREXTRA% 33: Echo INPUTDATA=%INPUTDATA% 34: Echo RARFiles=%RARFiles% 35: Echo IFFILEEXISTS=%IFFILEEXISTS% 36: Echo ---------------------------------------------------------37: IF NOT EXIST %NFOFile% goto NONFO
38: IF NOT EXIST %FILEID% goto NODIZ
39: set /a zipf=040: IF "%IFFILEEXISTS%"=="ABORT" (
41: FOR %%Z in (%BASEFILENAME%??.ZIP) DO (
42: GOTO ZIPSFOUND 43: ) 44: ) ELSE (45: Del /Q "%BASEFILENAME%??.zip"
46: Echo Delete "%BASEFILENAME%??.zip"
47: ) 48: Echo Just Double Checking :) 49: Echo -----------------------50: Echo Delete "%BASEFILENAME%.part??.rar"
51: DEL /Q "%BASEFILENAME%.part??.rar"
52: Echo Delete "%BASEFILENAME%.rar"
53: DEL /Q "%BASEFILENAME%.rar"
54: REM =================================================55: Echo Create RAR Archives %1.partXX.RAR for Data Selection %2
56: "%RARExe%" %RAROPT% -%RARVOLSIZE% %RAREXTRA% "%BASEFILENAME%" "%INPUTDATA%"
57: REM ================================================= 58: IF EXIST %BASEFILENAME%.RAR ( 59: set /a pos=1 60: ren %BASEFILENAME%.rar %BASEFILENAME%.RAR>NUL61: IF NOT EXIST "WORKDIR" MkDir "WORKDIR"
62: ) 63: IF NOT EXIST %BASEFILENAME%.RAR ( 64: set /a pos=0 65: Echo Rename %BASEFILENAME%.partXX.RAR to %BASEFILENAME%xx.RAR66: For /f %%x in ('dir /on /b "%BASEFILENAME%.part*.rar"') do (
67: set /a pos+=1 68: )69: if !pos!==0 goto NORAR
70: IF NOT EXIST "WORKDIR" MkDir "WORKDIR"
71: For /L %%n in (1,1,!pos!) do (
72: call :RenRAR %BASEFILENAME% %%n 73: ) 74: ) 75: Echo. 76: Echo ================================================= 77: Echo %pos% RAR volume(s) created! 78: Echo ================================================= 79: Echo Build List of RAR Archives in Folder...
80: dir /B /A:-D *.RAR >!RARFiles.txt 81: REM ================================================= 82: Echo Process RAR Archives... 83: Set REP1=TOTALFILES84: IF EXIST "FILE_ID.WRK" DEL /Q "FILE_ID.WRK">NUL
85: Call:SandR %FILEID% FILE_ID.WRK %REP1% %pos% 86: SET FCNT=0 87: Set REP2=CURRENTFILE88: FOR /F "delims=|" %%i IN (!RARFiles.txt) DO (
89: Echo Processing %%i 90: Set /a FCNT+=191: IF EXIST "FILE_ID.DIZ" DEL "FILE_ID.DIZ">NUL
92: Call:SandR FILE_ID.WRK FILE_ID.DIZ %REP2% !FCNT!93: IF EXIST "%%i.ZIP" del "%%i.ZIP">NUL
94: DEL /Q WORKDIR\*.*>NUL95: MOVE "%%i" "WORKDIR\%%i">NUL
96: IF EXIST "%NFOFile%" COPY "%NFOFile%" WORKDIR\>NUL
97: IF EXIST "FILE_ID.DIZ" COPY "FILE_ID.DIZ" WORKDIR\>NUL
98: IF EXIST "%INTROEXE%" COPY "%INTROEXE%" WORKDIR\>NUL
99: "%ZipExe%" -a "%%i.ZIP" "WORKDIR\*.*"
100: IF "%RARFiles%" == "KEEP" (MOVE WORKDIR\*.RAR>NUL)
101: DEL /Q WORKDIR\*.*>NUL 102: ) 103: REM ================================================= 104: Echo Build List of TEMP ZIP Files... 105: Dir /b *.RAR.ZIP>!ZIPfiles.txt 106: REM ================================================= 107: Echo Rename ZIP Files... 108: REM =================================================109: FOR /F "delims=." %%i IN (!ZIPfiles.txt) DO (
110: Echo Rename %%i.RAR.ZIP to %%i.ZIP111: IF EXIST "%%i.ZIP" del "%%i.ZIP"
112: REN "%%i.RAR.ZIP" "%%i.ZIP"
113: ) 114: REM ================================================= 115: Echo Deleting TEMP Files... 116: IF EXIST !ZIPfiles.txt Del /Q !ZIPfiles.txt 117: IF EXIST !RARfiles.txt Del /Q !RARfiles.txt118: IF EXIST "FILE_ID.WRK" DEL /Q "FILE_ID.WRK">NUL
119: IF EXIST "FILE_ID.DIZ" DEL /Q "FILE_ID.DIZ">NUL
120: RmDir WORKDIR>NUL 121: ECHO ================================================= 122: ECHO Done! 123: ECHO ================================================= 124: Echo. 125: Pause126: goto END
127: 128: REM ============================================= 129: REM PROCESSING FUNCTIONS 130: REM ============================================= 131: :READINI 132: Set key=%~2 133: call:strLen key len134: Set /a "len+=1"
135: set yfs= 136: set ymn=137: for /f "tokens=*" %%i in ( ProcRel.ini ) do (
138: set ywv=%%i139: if /i "!ywv!"=="[%1]" (
140: set yfs=Y141: ) else (
142: set ywv=!ywv:~0,%len%!143: if defined yfs (
144: if not defined ymn (
145: if /i "!ywv!"=="%2=" (
146: set ymn=%%i 147: set ymn=!ymn:~%len%! 148: ) 149: ) 150: ) 151: ) 152: ) 153: Set %~2=%ymn% 154: GOTO :EOF 155: REM ============================================= 156: :strLen -- returns the length of a str, max 1023157: :: -- %~1: in - varible name of a string variable
158: :: -- %~2: out- string length
159: SETLOCAL 160: set str=A!%~1! 161: set len=0 162: set /a n=1024 163: set /a n^>^>=1, len+=n164: if !str:~%len%!. == . set /a len-=n
165: set /a n^>^>=1, len+=n166: if !str:~%len%!. == . set /a len-=n
167: set /a n^>^>=1, len+=n168: if !str:~%len%!. == . set /a len-=n
169: set /a n^>^>=1, len+=n170: if !str:~%len%!. == . set /a len-=n
171: set /a n^>^>=1, len+=n172: if !str:~%len%!. == . set /a len-=n
173: set /a n^>^>=1, len+=n174: if !str:~%len%!. == . set /a len-=n
175: set /a n^>^>=1, len+=n176: if !str:~%len%!. == . set /a len-=n
177: set /a n^>^>=1, len+=n178: if !str:~%len%!. == . set /a len-=n
179: set /a n^>^>=1, len+=n180: if !str:~%len%!. == . set /a len-=n
181: set /a n^>^>=1, len+=n182: if !str:~%len%!. == . set /a len-=n
183: ( ENDLOCAL & REM RETURN VALUES184: IF "%~2" NEQ "" SET %~2=%len%
185: ) 186: GOTO:EOF 187: REM ============================================= 188: :SandR 189: REM Search And Replace 190: SETLOCAL191: for %%i in (%1) do (
192: for /f "tokens=1,* delims=]" %%a in ('"type %%i|find /n /v """') do (
193: set "line=%%b"
194: if defined line (
195: call set "line=echo.%%line:%3=%4%%"
196: for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X>>%2
197: ) ELSE echo.>>%2 198: ) 199: ) 200: ENDLOCAL201: goto :eof
202: REM ================================================= 203: :RenRAR204: IF EXIST "%1.part%2.rar" (
205: ren "%1.part%2.rar" "%1%2.RAR"
206: echo ren "%1.part%2.rar" "%1%2.RAR"
207: ) else (
208: IF EXIST "%1.part0%2.rar" (
209: ren "%1.part0%2.rar" "%10%2.RAR"
210: echo ren "%1.part0%2.rar" "%10%2.RAR"
211: ) 212: ) 213: GOTO :EOF 214: 215: REM ================================================= 216: REM ERROR MESSAGE FUNCTIONS 217: REM ================================================= 218: :NORAR 219: echo. 220: Echo Error! 221: echo Error! No RAR Archives with the file names 222: echo %BASEFILENAME%.partXX.RAR 223: echo were Created!224: goto END
225: REM ================================================= 226: :NONFO 227: echo. 228: Echo Error! 229: echo NFO-File %NFOFile% not found!230: goto END
231: REM ================================================= 232: :NODIZ 233: echo. 234: Echo Error! 235: echo File_ID.DIZ Template File NOT Found at %FILEID%236: goto END
237: REM ================================================= 238: :ZIPSFOUND 239: echo. 240: Echo Error! (ABORT Parameter specified) 241: Echo Current directory contains already one or more ZIP files 242: Echo with the name: %BASEFILENAME%??.ZIP 243: goto END
244: REM ================================================= 245: :END 246: REM Finished! 247: Echo. 248: Goto :EOFProcRel.ini
Sample INF configuration file
1: [SETTINGS] 2: ;or C:\PROGRAM FILES\WinXXX under XP 3: ZipExe=C:\PROGRAM FILES (X86)\WinZip\WZZIP.EXE 4: RARExe=C:\PROGRAM FILES (X86)\WinRAR\RAR.EXE 5: NFOFile=COOLGROUP.nfo 6: FILEID=File_ID.TMP 7: INTROEXE=CoolIntro.exe 8: BASEFILENAME=TEST 9: ;a=add, use rn to move Input Data instead 10: RAROPT=a 11: ;v98078k (100MB), v4096k (4 MB) etc. 12: RARVOLSIZE=v98078k 13: RAREXTRA=-m5 -r 14: INPUTDATA=C:\RELEASE FILES\COOL RELEASE\*.* 15: ;DEL or KEEP 16: RARFiles=DEL 17: ;ABORT or OVERWRITE 18: IFFILEEXISTS=ABORTAgain, everything is included in the release ZIP archive of the script, which you can download below.
Download
Roy-ProcessReleases21.ZIP (365 KB)
Cheers!
Carsten aka Roy/SAC
No comments:
Post a Comment
Hi, thanks for taking the time to comment at my blog.
Due to spam issues comments are not immediately posted on the site and require my manual approval first, before they become visible.
I try to approve comments as quickly as possible and usually within 24 hours.
To be notified about follow up comments that are made after yours, use the subscribe option with your email address and you will receive an email alert, if somebody else comments at this post in the future.
Also check out the rest of the website beyond this blog, visit RoySAC.com. Also see my YouTube channels, SACReleases for intros and demos.
Cheers!
Carsten aka Roy/SAC
Note: Only a member of this blog may post a comment.