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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.