Archived Forum Post

Index of archived forum posts

Question:

SFTP file not found error even when using correct realpath path, Why?

Jun 11 '14 at 14:36

I am getting a file not found error. The Realpath(".","") returns null and sometimes "/" but not ".". It works for other users on the same SFTP server however it fails for this one. The "/test/Monthly_files_012014/test.mat" is the correct path however it seems to be substituting "./test/Monthly_files_012014/test.mat". Why would this not work? I have tried both 9.1.2 and 9.5.0.39 chilkatDontNet2 versions and both DownloadFileByName and OpenFile-DownloadFile methods.

C# code:
  _sftp.RealPath(ftpf.SourcePath + "/" + ftpf.FileName,"")
produces:
  "/test/Monthly_files_012014/test.mat"

C# code:
success = _sftp.DownloadFileByName(_sftp.RealPath(ftpf.SourcePath + "/" + ftpf.FileName,""), destfilepath);
Produces the below error:
"ChilkatLog:
 DownloadFileByName:
   DllDate: May  8 2014
   ChilkatVersion: 9.5.0.39
   UnlockPrefix: XXXXXXX
   Username: XXXXXXX
   Architecture: Little Endian; 32-bit
   Language: .NET 2.0
   VerboseLogging: 0
   SshVersion: SSH-2.0-1.82_sshlib
   SftpVersion: 3
   downloadFileByName:
     PreserveDate: 0
     fromFilePath: /test/Monthly_files_012014/test.mat
     toFilePath: Download\\test.mat
     OpenRemoteFile:
       sftpOpenFile:
         remotePath: /test/Monthly_files_012014/test.mat
         access: readOnly
         createDisposition: openExisting
         v3Flags: 0x1
         Sent FXP_OPEN
         StatusResponseFromServer:
           Request: FXP_OPEN
           InformationReceivedFromServer:
             StatusCode: 2
             StatusMessage: File not found
           --InformationReceivedFromServer\
          --StatusResponseFromServer
         retryFilepath: ./test/Monthly_files_012014/test.mat
         remotePath: ./test/Monthly_files_012014/test.mat
         access: readOnly
         createDisposition: openExisting
         v3Flags: 0x1
         Sent FXP_OPEN
         StatusResponseFromServer:
           Request: FXP_OPEN
           InformationReceivedFromServer:
             StatusCode: 2
             StatusMessage: File not found
           --InformationReceivedFromServer
         --StatusResponseFromServer
       --sftpOpenFile
       timeToOpenMs: Elapsed time: 156 millisec
     --OpenRemoteFile
     totalTimeMs: Elapsed time: 156 millisec
   --downloadFileByName
   Failed.
 --DownloadFileByName
--ChilkatLog"