DOS BATCH FILE HELP

Comments are in red, use and abuse this script if you want to do something similar! Let me know how you get on.

@echo off

:top
cls
echo Searching for camxxxx1.jpg every 180 seconds.
CHOICE /C:FPX /T:F,180 F=Force File Search P=Pause X=Exit Checks every 3 minutes for new files
if errorlevel 3 goto Term
if errorlevel 2 goto sleep
if errorlevel 1 goto change goto top

:change Renames all files with the extention .jpg to a numbered sequence camxxxx1,camxxxx2 etc.
LFNFOR On
FOR %%v IN (*.jpg) DO REN %%v XXXXXX%%v.x
REN *.x *
LFNFOR Off
FOR %%v IN (*.*) DO REN %%v %%v
REN *~?.jpg "camxxxx?.jpg"
LFNFOR On
FOR %%v IN (" *.*") DO REN "%%v" %%v
LFNFOR OFF
goto search

:search Checks to see if any files were found, if not it goes back to the start to wait another 3 minutes
if not exist c:\windows\desktop\securi~1\camxxxx1.jpg goto top if the first file exists, then 4 files are prepared for FTP
if not exist c:\windows\desktop\securi~1\camxxxx2.jpg copy c:\windows\desktop\securi~1\temp\camxxxx2.jpg
if not exist c:\windows\desktop\securi~1\camxxxx3.jpg copy c:\windows\desktop\securi~1\temp\camxxxx3.jpg
if not exist c:\windows\desktop\securi~1\camxxxx4.jpg copy c:\windows\desktop\securi~1\temp\camxxxx4.jpg
ftp.exe -s:"c:\windows\desktop\securi~1\script.txt" FTP files using the script.txt script
del c:\windows\desktop\securi~1\camxxxx?.jpg Remove the FTP'd files
goto bot only do this once, since this is for an automated DUN connection, if permantly connected change this to goto top

:sleep
echo Webcam is now in pause mode.
pause
goto top

:term
echo User Terminated Session!

:bot
exit

BACK