Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Get operation doesn't throw error when file is not found on server

That's by design. The argument of the GetFiles method is a file mask. In your case that mask can actually match a single specific file only. Still, if the mask does not match anything, it's not an error. You can use the return value of the method to check if anything was downloaded (instead of explicitly checking file existence - what is prone to race conditions).
sumangeorge

Re: Get operation doesn't throw error when file is not found on server

Ok so i got a workaround for this issue.
For those facing the same issue please see my response below:
We can check if the file exists before hitting Get request.
In my case i need to throw error and send mails to user saying that file doesn't exist.:
    fileExist = session.FileExists("/read.me.txt")

    If (fileExist = True) Then
        Set transferResult = session.GetFiles("/read1.me", strTemp_File_Dir, False, transferOptions)
    End If
sumangeorge

Get operation doesn't throw error when file is not found on server

I was doing some testing of my code.
It seems one of my Get operation (Which copies file from server to my local) is passed even if there is no file present in the server.
In the code below there is no error in this scenario.

Set transferResult = session.GetFiles("/read1.me", strTemp_File_Dir, False, transferOptions)

    If Err.Number <> 0 Then
        ' Disconnect, clean up
        MsgBox ("Got Error!!")
        session.dispose
    End If
    Err.Clear
    ' Restore default error handling
    On Error GoTo 0