Gunit2507
asked on
Do Something ONLY if the Uploaded was succesfull
I have the following script, and I want it to write it so it only puts stuff in the FilesOnServer.txt if all 6 documents were uploaded succesfully, and only put the stuff in UploadTemp.txt that was uploaded succesfully. So basically if I would loose my internet connection while this program is running, I do not want put the stuff in my upload documnets, because it really was never uploaded.
@echo off
set ServerFiles=FilesOnServer. txt
set UploadedFiles=UploadTemp.t xt
echo username>_temp.txt
echo password>>_temp.txt
echo binary>>_temp.txt
echo cd \Results\DCI_Reporter\>>_t emp.txt
for %%f in (*.dat) do CALL :CHECK_0 "%%f"
for %%f in (*UploadTemp.txt) do echo put %%f>>_temp.txt
echo bye>>_temp.txt
ftp -v -i -s:_temp.txt ftp.topdeckcards.com
del _temp.txt>NUL
del UploadTemp.txt>NUL
"C:\Program Files\Internet Explorer\iexplore.exe" -nohome "http://www.topdeckcards.com/Results/DCI_Processor.asp"
GOTO :EOF
:CHECK_0
SET File=%~1
SET File=%File: =%
FIND /i "%File:~0,4%" "%ServerFiles%">NUL
IF %ERRORLEVEL% NEQ 0 CALL :NEXT_0 "%File:~0,4%"
EXIT /B
:NEXT_0
SET Tag=%~1
SET FlagDelt=0
SET FlagFas2=0
SET FlagKamp=0
SET FlagLog=0
SET FlagRund=0
SET FlagSkem=0
IF EXIST "%Tag%Delt.dat" SET FlagDelt=1
IF EXIST "%Tag%Fas2.dat" SET FlagFas2=1
IF EXIST "%Tag%Kamp.dat" SET FlagKamp=1
IF EXIST "%Tag%Log.dat" SET FlagLog=1
IF EXIST "%Tag%Rund.dat" SET FlagRund=1
IF EXIST "%Tag%Skem.dat" SET FlagSkem=1
SET /a FlagCount=%FlagDelt%+%Flag Fas2%+%Fla gKamp%+%Fl agLog%+%Fl agRund%+%F lagSkem%
IF %FlagCount% GEQ 6 (
echo put %tag%Delt.dat>>_temp.txt
echo put %tag%Fas2.dat>>_temp.txt
echo put %tag%kamp.dat>>_temp.txt
echo put %tag%Log.dat>>_temp.txt
echo put %tag%Rund.dat>>_temp.txt
echo put %tag%Skem.dat>>_temp.txt
echo %Tag%>>%ServerFiles%
echo %Tag%>>%UploadedFiles%
)
EXIT /B
@echo off
set ServerFiles=FilesOnServer.
set UploadedFiles=UploadTemp.t
echo username>_temp.txt
echo password>>_temp.txt
echo binary>>_temp.txt
echo cd \Results\DCI_Reporter\>>_t
for %%f in (*.dat) do CALL :CHECK_0 "%%f"
for %%f in (*UploadTemp.txt) do echo put %%f>>_temp.txt
echo bye>>_temp.txt
ftp -v -i -s:_temp.txt ftp.topdeckcards.com
del _temp.txt>NUL
del UploadTemp.txt>NUL
"C:\Program Files\Internet Explorer\iexplore.exe" -nohome "http://www.topdeckcards.com/Results/DCI_Processor.asp"
GOTO :EOF
:CHECK_0
SET File=%~1
SET File=%File: =%
FIND /i "%File:~0,4%" "%ServerFiles%">NUL
IF %ERRORLEVEL% NEQ 0 CALL :NEXT_0 "%File:~0,4%"
EXIT /B
:NEXT_0
SET Tag=%~1
SET FlagDelt=0
SET FlagFas2=0
SET FlagKamp=0
SET FlagLog=0
SET FlagRund=0
SET FlagSkem=0
IF EXIST "%Tag%Delt.dat" SET FlagDelt=1
IF EXIST "%Tag%Fas2.dat" SET FlagFas2=1
IF EXIST "%Tag%Kamp.dat" SET FlagKamp=1
IF EXIST "%Tag%Log.dat" SET FlagLog=1
IF EXIST "%Tag%Rund.dat" SET FlagRund=1
IF EXIST "%Tag%Skem.dat" SET FlagSkem=1
SET /a FlagCount=%FlagDelt%+%Flag
IF %FlagCount% GEQ 6 (
echo put %tag%Delt.dat>>_temp.txt
echo put %tag%Fas2.dat>>_temp.txt
echo put %tag%kamp.dat>>_temp.txt
echo put %tag%Log.dat>>_temp.txt
echo put %tag%Rund.dat>>_temp.txt
echo put %tag%Skem.dat>>_temp.txt
echo %Tag%>>%ServerFiles%
echo %Tag%>>%UploadedFiles%
)
EXIT /B
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.