@setlocal
@echo Zip 3rd party sources...
@set TEMP1=C:\MDOS\zipsrc.bat
@set TEMP2=srclist.txt
@set TEMP3=zips
@set TEMP4=zipsetup.bat

@if NOT EXIST %TEMP1% goto ERR1
@if NOT EXIST %TEMP2% goto ERR2
@if NOT EXIST %TEMP3%\. goto ERR3
@if NOT EXIST %TEMP4% goto ERR4
@call %TEMP4%
@if "%TEMPVERS%x" == "x" goto ERR5

@REM CHECK FOR PREVIOUS FILES
@for /F "tokens=1,*" %%i in (%TEMP2%) do @(call :CHKIT %%i)
@echo Proceed to create zips...
@pause

@for /F "tokens=1,*" %%i in (%TEMP2%) do @(call :ZIPIT %%i)
@goto END

:CHKIT
@if "%1x" == "x" goto :EOF
@set TEMPZ=%TEMP3%\%1-src-%TEMPVERS%.zip
@if EXIST %TEMPZ% goto BADZIP
@goto :EOF

:BADZIP
@echo ERROR: ZIP file %TEMPZ% already exists...
@echo Delete, rename or move it first...
@pause
@if EXIST %TEMPZ% goto BADZIP2
@goto :EOF

:BADZIP2
@echo ERROR: ZIP file %TEMPZ% already exists...
@echo USE Ctrl+C to abort this batch file...
@pause
@if EXIST %TEMPZ% goto BADZIP3
@goto :EOF

:BADZIP3
@echo ERROR: REPEATED REPEATED
@echo ERROR: ZIP file %TEMPZ% already exists...
@echo USE Ctrl+C to abort this batch file...
@pause
@if EXIST %TEMPZ% goto BADZIP4
@goto :EOF

:BADZIP4
@echo ERROR: REPEATED REPEATED REPEATED
@echo ERROR: ZIP file %TEMPZ% already exists...
@echo USE Ctrl+C to abort this batch file...
@pause
@if EXIST %TEMPZ% goto BADZIP5
@goto :EOF

:BADZIP5
@echo ERROR: REPEATED REPEATED REPEATED REPEATED
@echo ERROR: ZIP file %TEMPZ% already exists...
@echo USE Ctrl+C to abort this batch file...
@pause
@echo USE Ctrl+C to abort this batch file...
@pause
@echo USE Ctrl+C to abort this batch file...
@pause
@echo BAH! COntinuing anyway...
@goto END

:ZIPIT
@if "%1x" == "x" goto :EOF
@echo Folder %1
@set TEMPZ=%TEMP3%\%1-src-%TEMPVERS%.zip
@call %TEMP1% %1 %TEMPZ%
@goto :EOF


:ERR1
@echo.
@echo ERROR: Can NOT locate %TEMP1% batch file... check name, location...
@echo This is a specialised batch file, that excludes lots of file types...
@echo and then uses WinZip command line tool to do the zipping...
@echo It takes two commands - folder to zip, and output zip file...
@echo.
@goto END

:ERR2
@echo.
@echo ERROR: Can NOT locate %TEMP2% text file... check name, location...
@echo This is a list of FOLDERS to zip... simple text file...
@echo.
@goto END

:ERR3
@echo.
@echo ERROR: Can NOT locate %TEMP3% folder file... check name, location...
@echo This OUTPUT folder for ZIP files MUST exist... It will NOT be created...
@echo.
@goto END

:ERR4
@echo.
@echo ERROR: Can NOT locate %TEMP4% text file... check name, location...
@echo This sets environment variables to the current versions
@echo It sets -
@echo set TEMPVERS=11
@echo set TEMPVCV=vc9
@echo set TEMPVERS6=11
@echo set TEMPVCV6=vc6
@echo or later versions...
@echo THis batch file ONLY uses 'TEMPVERS'...
@echo.
@goto END

:ERR5
@echo.
@echo Ran %TEMP4% batch file, but TEMPVERS NOT SET in environment...
@echo.
@goto END

@echo.
@goto END


:END


