Archived Forum Post

Index of archived forum posts

Question:

SFTP -file not Found

Dec 24 '15 at 10:42

I am getting "file not found issue" with the following error message.But i am able to move( if (!sftp.RenameFileOrDir(@"OutputADV_MSB_20150602.xlsx", @"ArchiveADV_MSB_20150602.xlsx"))) the file using a console application.Need help on this issue

 RenameFile:
    DllDate: Oct 29 2015
    ChilkatVersion: 9.5.0.54
    UnlockPrefix: CORLGCSSH
    Username: ADVQN1VTAPEVT18:FASLOEvents
    Architecture: Little Endian; 64-bit
    Language: .NET 4.0 / x64
    VerboseLogging: 0
    SshVersion: SSH-2.0-1.82_sshlib GlobalSCAPE
    SftpVersion: 3
    oldFilename: OutputADV_MSB_20150602.xlsx
    newFilename: ArchiveADV_MSB_20150602.xlsx
    sshReadMessage:
      mType: CHANNEL_WINDOW_ADJUST
    --sshReadMessage
    sshReadMessage:
      mType: CHANNEL_DATA
    --sshReadMessage
    StatusResponseFromServer:
      Request: FXP_RENAME
      InformationReceivedFromServer:
        StatusCode: 2
        StatusMessage: File not found
      --InformationReceivedFromServer
    --StatusResponseFromServer
    Failed.
  --RenameFile


Answer

If you do not use full path names, just the file name, SFTP will use the "user's default directory". The file is likely somewhere else.

Make sure to read http://www.cknotes.com/understanding-sftp-absolute-filepaths/

and the documentation for OpenDir: https://www.chilkatsoft.com/refdoc/vcCkSFtpDoc.html#method35 where it says "...An empty path name is valid, and it refers to the user's default directory (usually the user's home directory)..."


Answer

Also SFTP act different whether Windows or Unix. Also Unix behaves different if the file system is mounted.

The two SFTP and FTP should be combined. When you do a Change Directory, the module should be smart enough to figure out the path.

SFTP is really a pain when dealing with other folders. I have to always use a debugger when trying to figure out the server file destinations.