The following batch file is what I wrote and use. It intelligently stops when everything is done. It's not idiot-proof, but I've been using it for over a week now with no problems.
If you want to stop uploading, delete the "upload.lock" file in the directory. The BAT checks for it every time it restarts the upload process. If you just kill the BAT, you can end up losing your error.log file.
The "if [%E2%]==[] set E2=0. . . . ." (first 30 or so lines) at the beginning is just for the counter. Don't delete it!
Code:
@echo off
IF EXIST error.log REN error.log error.log.old
:restart
:: *************************
:: COUNTER
:: *************************
:: Increments a three digit number
:: Works by comparing each digit
:: E2=hundreds, E1=tens, E0=ones
if [%E2%]==[] set E2=0
if [%E1%]==[] set E1=0
if [%E0%]==[] set E0=0
:E0
if %E0%==9 goto E1
if %E0%==8 set E0=9
if %E0%==7 set E0=8
if %E0%==6 set E0=7
if %E0%==5 set E0=6
if %E0%==4 set E0=5
if %E0%==3 set E0=4
if %E0%==2 set E0=3
if %E0%==1 set E0=2
if %E0%==0 set E0=1
goto DONE
:E1
set E0=0
if %E1%==9 goto E2
if %E1%==8 set E1=9
if %E1%==7 set E1=8
if %E1%==6 set E1=7
if %E1%==5 set E1=6
if %E1%==4 set E1=5
if %E1%==3 set E1=4
if %E1%==2 set E1=3
if %E1%==1 set E1=2
if %E1%==0 set E1=1
goto DONE
:E2
set E1=0
if %E2%==9 set E2=0
if %E2%==8 set E2=9
if %E2%==7 set E2=8
if %E2%==6 set E2=7
if %E2%==5 set E2=6
if %E2%==4 set E2=5
if %E2%==3 set E2=4
if %E2%==2 set E2=3
if %E2%==1 set E2=2
if %E2%==0 set E2=1
goto DONE
:DONE
:: *************************
:: COUNTER END
:: *************************
ECHO ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ECHO Starting Upload (Attempt: %E2%%E1%%E0%)
echo Upload lock file > upload.lock
START /w /m foldtrajlite -f protein -n native -df -u t
FIND /C "NO RESPONSE FROM SERVER" error.log > nul
:: FIND returns an errorlevel of 1 or higher if the search string WASN'T found.
IF ERRORLEVEL 1 GOTO finished
IF NOT EXIST Upload.lock GOTO quit
copy error.log.old+error.log error.log.tmp > nul
del error.log.old
del error.log
ren error.log.tmp error.log.old
GOTO restart
:finished
echo Upload finished !!!
GOTO end
:quit
echo Lock file not found, quitting . . .
GOTO end
:end
IF EXIST Upload.lock DEL Upload.lock
@copy error.log.old+error.log error.log.tmp
del error.log.old
del error.log
ren error.log.tmp error.log
@echo off
cls
P.S. Forgot to mention - this runs fine on Win98 (my office machine with fast i-net). Didn't check with 2K or XP - but hey, this is generic BAT code, should run. Let me know if it doesn't.