Simple FTP Connection With Error Recovery

Top  Previous  Next

 

This example again builds on the previous one but shows how a dial-up FTP file transfer session might be controlled with a Robo-FTP script file.

 

DIALNET "Internet Connection" /user=myname /pw=mypassword

;; check for connection

IFERROR= $ERROR_CONNECT_TIMEOUT GOTO connect_timeout

;; just exit if any other error

IFERROR GOTO exit

;; make sure we’re in FTP mode & logon to FTP site

FTPLOGON "ftp.acme-widget.com" /user=anonymous /pw=any /timeout=30

IFERROR GOTO disconnect

;; change to desired directory

FTPCMD "CWD robo-ftp/incoming"

;; upload a file to an FTP site

SENDFILE "datafile" /timeout=60

;; check for send time-out

IFERROR= $ERROR_OPTIMEDOUT GOTO xmt_timeout

;; logoff and disconnect

:logoff

FTPLOGOFF

:disconnect

DISCONNECT

:exit

EXIT

:connect_timeout

MESSAGEBOX "**ATTENTION: Cannot connect, dial time-out"

EXIT

:xmt_timeout

MESSAGEBOX "**ATTENTION: Remote unable to receive"

GOTO logoff