SFTP RemoveFile – File not found

Question:

When trying to delete a file using SFTP with this line:

success = sftp.RemoveFile(“out/” & fileObj.Filename)

we get the error listed below:

ChilkatLog:
  RemoveFile:
    DllDate: Feb  8 2009
    UnlockPrefix: Anything for 30-day trial
    Username: IUSR_ABCD
    Component: ActiveX
    SshVersion: SSH-2.0-1.36 sshlib: GlobalScape
    SftpVersion: 3
    hcCurDate: Wed, 18 Feb 2009 14:23:01 +1100
    hcExpire: 4/2009
    filename: out/abc123.edi
    StatusCode: 2
    ErrorMessage: File not found
    Failed.


Answer:

Given that you are passing a relative filepath to RemoveFile, you should understand
that it is relative to the home directory of the SSH/SFTP account.
If you are unsure, you can pass the filepath to the RealPath method
to determine the absolute filepath on the server.

Tags :