Two weeks ago I wrote a simple FTP get/put for multiple files based on examples in the help file for Wininit Extender. Got an IM from a fellow worker who was using it tonight and while the put worked, the get gave the iFTPGet Failed message.
If getfile==0 Then Display(5,"Error","iFtpGet Failed on File: %remote_srcfile%":@CRLF:"FileSize: ":fSize)
The script has an error handler; it closes down the connection, displays the error and exits, but that line doesn't generate an error. So, if I assume the failure is a minor error such as a timeout, or a large file size is there a way to detect additional info about the failure, as maybe that is just one file out of many.
Hope this makes sense
Yes. You need to call iGetLastError. See Also iGetResponse.
rslt=iFtpPut(conhandle, "C:\temp\abc.txt","temp/abc.test",0,@ASCII, @TRUE)
If rslt==0
lasterr = iGetLastError()
lastresp = iGetResponse()
Message("iFtpPut Last Error: %lasterr%", lastresp)
EndIf
Thanks.
IMO, you should always check and parse the FTP response, and don't call it good unless the response so indicates. iGetResponse returns a string, of which the first three characters are a standard FTP status code.
The following code snippet gets the response and extracts the status code from it, and converts it to an integer.
rLastResultCode = Int ( StrSub ( iGetResponse() , 1 , 3 ) )
I've attached a WIL #include file, FormatFTPResponse_P6C.WIL, which contains a like named User Defined Function, FormatFTPResponse_P6C(), that cleans up the text portion of the response.
Thanks again. As it turns out, it was my bad. I was in a hurry and sought out the remote folder with iLoc rather than iFtp.
As of lates last night the compiled script worked perfectly to both send and receive.
Quote from: stanl on January 29, 2014, 08:23:10 AM
Thanks again. As it turns out, it was my bad. I was in a hurry and sought out the remote folder with iLoc rather than iFtp.
As of lates last night the compiled script worked perfectly to both send and receive.
You are welcome,. Sir!