Im trying to make this batch script check on resumption that it has not processed if a file before and continue with the ones it hasnt. i.e if it has processed a file, skip to the next one. What would I need to make this do such. thanks
@echo off
setlocal enabledelayedexpansion
set EXE_FILE=E:\opencv\build\bin\Release\blobtrack_sample.exe
set INPUT_PATH=E:\Glasgow\Test\
set TRACKS_PATH=E:\Glasgow\Tracks\
set COUNT=0
pushd %INPUT_PATH%
for %%f in (*) do if %%f neq %~nx0 (
set /a COUNT+=1
echo Processing %%f, track=%%~nf.txt, btavi=test!COUNT!%%~xf
%EXE_FILE% fg=FG_0S bd=BD_CC bt=CCMSPF btpp=None bta=Kalman btgen=RawTracks track=%TRACKS_PATH%\%%~nf.txt FGTrainFrames=125 %%f
)
popd
You can check whether
%OUTPUT_PATH%\%%~nf.aviexists:But that has a slight problem. If processing breaks for some reasin in the middle of a written file you have half a file that doesn’t get processed again, because you equate existence with completion.
A more robust way would be to write to a temporary file first and then rename it: