@setlocal
@REM 20120520 - Exclude TMPFIL from count
@echo Cleaning up...
@call clobnow
@set TMPFIL=templist.txt
@set TMPOD=zips
@set COUNT=0
@set TMPZIP=perlmark.zip
@set TMPZ=

:RPT
@set /A COUNT+=1
@if %COUNT% LSS 10 (
@set TMPZ=perlmark-0%COUNT%.zip
) else (
@set TMPZ=perlmark-%COUNT%.zip
)
@set TMPZIP=%TMPOD%\%TMPZ%
@if EXIST %TMPZIP% goto RPT

@dir /od /b >%TMPFIL%

@set TMPHM=no
@set TMPLIST=
@set COUNT=0
@set TMPCNT=0

@for /F %%i in (%TMPFIL%) do @(call :CHKIT %%i)

@echo Will zip and save since MARKER to %TMPZIP%
@echo List is -
@for %%i in (%TMPLIST%) do @(call :SHOW %%i)
@echo That is %COUNT% files of %TMPCNT%
@set TMPO=-a
@if EXIST %TMPZIP% (
@echo NOTE: This is an UPDATE ONLY
@set TMPO=-u
)
@echo Will do 'call zip8 %TMPO% -o %TMPZIP% %TMPLIST%'
@echo.
@echo *** CONTINUE? *** Only Ctlr+c will abort. All other keys continue...
@pause

@call zip8 %TMPO% -o %TMPZIP% %TMPLIST%
@if NOT EXIST %TMPZIP% (
@echo ZIP FAILED!
@goto END
)

@cd %TMPOD%
@call copy2tmp %TMPZ%
@cd ..

@goto END

:SHOW
@if "%1x" == "x" goto :EOF
@if NOT EXIST %1 (
@echo HUH! FIle %1 does NOT exist!
) else (
@call dirmin %1
)
@goto :EOF


:CHKIT
@if "%1x" == "x" goto :EOF
@if "%1x" == "zipsx" goto :EOF
@if "%1x" == "%TMPFIL%x" goto :EOF
@set TMPx=%~x1
@if "%TMPX%x" == ".zipx" goto :EOF
@if "%TMPHM%x" == "yesx" (
@set TMPLIST=%TMPLIST% %1
@set /A COUNT+=1
) else (
@if "%1x" == "MARKERx" (
@echo Found MARKER
@set TMPHM=yes
)
)
@set /A TMPCNT+=1
@goto :EOF


:END
