Archived Forum Post

Index of archived forum posts

Question:

SFTP GetFileSize32 by Handle Fails with "File not Found"

Apr 23 '13 at 15:55

The SFTP server returns a file-not-found error when trying to use the handle of an opened remote file for the GetFileSize32 method. For example:

        Using sftp As New Chilkat.SFtp()
            Dim fileLength As Long
            handle = l_sftp.OpenFile(remoteFilePath, "readOnly", "openExisting")
            fileLength = l_sftp.GetFileSize32(handle, False, True)
        End Using


Answer

It's possible that this is due to a server bug.

The GetFileSize32 function works fine using a later version of the SSH server (SSH-2.0-1.82). The one it failed on has SSH-2.0-1.36.

Passing the remote file path to GetFileSize32 works fine with both SSH server versions.