A question about FTP.EXE and scripting - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

A question about FTP.EXE and scripting

InFeStEdInFeStEd Posts: 32Member
[b]Situation[/b]:
I'm scripting for FTP.EXE in dos. I wrote a batch file and a script file to be executed by the FTP.EXE program. In the batch file I have this line:

[italic]ftp -s:.Funcs.txt >> .Log.txt[/italic]

That executes the program with the script file and does all my uploading. This program works fine. No problems, unless I lose my connection. When the FTP program loses connection it just executes what is left in the script while not connected. I dislike this. The program fails and has to be run again.

[b]My question[/b]:
How can I get the FTP batch file or script to detect when the connection is lost and either reconnect immediately THEN resume with the rest of the instructions or detect that the connection was lost and run the program again in the batch file?

Thanks. Any feedback is appreciated!


Comments

  • melissa_may1melissa_may1 Posts: 937Member
    Doesn't FTP have an exit code? An exit code would tell you if there was an error, or if the transfer was complete. You could then test for the error code in your batch file, immediately after the ftp command.

    Melissa


    : [b]Situation[/b]:
    : I'm scripting for FTP.EXE in dos. I wrote a batch file and a script file to be executed by the FTP.EXE program. In the batch file I have this line:
    :
    : [italic]ftp -s:.Funcs.txt >> .Log.txt[/italic]
    :
    : That executes the program with the script file and does all my uploading. This program works fine. No problems, unless I lose my connection. When the FTP program loses connection it just executes what is left in the script while not connected. I dislike this. The program fails and has to be run again.
    :
    : [b]My question[/b]:
    : How can I get the FTP batch file or script to detect when the connection is lost and either reconnect immediately THEN resume with the rest of the instructions or detect that the connection was lost and run the program again in the batch file?
    :
    : Thanks. Any feedback is appreciated!
    :


Sign In or Register to comment.