We help IT Professionals succeed at work.
Get Started

Do Something ONLY if the Uploaded was succesfull

Gunit2507
Gunit2507 asked
on
2,133 Views
Last Modified: 2012-06-21
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.txt

echo username>_temp.txt
echo password>>_temp.txt
echo binary>>_temp.txt
echo cd \Results\DCI_Reporter\>>_temp.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%+%FlagFas2%+%FlagKamp%+%FlagLog%+%FlagRund%+%FlagSkem%

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
Comment
Watch Question
Top Expert 2007
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE