ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
I'm in a situation where I'm trying to automate the upload of thousands of files a day. the problem is, sometimes they fail, there is a server timeout or some sort of corruption or ??. The server may get disconnected, so I need to find a way to verify the connection to the FTP server is still valid before each upload. Is there some sort of command I can send to get a response from the server (preferably not something that lists the files in the dir, cause some of them have A LOT), just a small check with response or something.
Hi there,

There are two ways for checking a connection, depending on the version of ScriptFTP you have.

For the current version (3.2), you have to use RAWCOMMAND to send the FTP protocol request "NOP". Getting "200" in the response means that the connection is still alive:
Code: Select all$result=RAWCOMMAND("NOP") IF($result=="200")  PRINT("Connection is still valid") ELSE  PRINT("Connection is broken. Reconnecting.")  GOTO :reconnect END IF

For the upcoming version (3.3) which will be released today or tomorrow you have a new command called ISCONNECTED. It makes checking the connection a little easier:
Code: Select allIF(ISCONNECTED())  PRINT("Connection is still valid") ELSE  PRINT("Connection is broken. Reconnecting.")  GOTO :reconnect END IF
The upcoming version is currently under the beta testing. As soon as I finish some details I will release it, in the meantime you can download it from here:

http://www.ScriptFTP.com/ScriptFTP_3_3_beta_setup.exe
perfect, thank you!
BTW, for those that are visiting this topic,the version 3.3 has been released so the link above is no longer working. To get the command ISCONNECTED working just go to the Downloads section and download the version 3.3.