Archived Forum Post

Index of archived forum posts

Question:

RenameFileOrDir

Jul 04 '13 at 09:12

Hi There,

I have a Problem with renaming/moving a file on an sftp Server, the following error:

I can download the File, but i cant rename it, any ideas?

success = sftp.DownloadFileByName("/content/outlet/edit/outlet_edit.lib.php", tmp_file) <-- WORKS

success = sftp.RenameFileOrDir("/content/outlet/edit/outlet_edit.lib.php", "/content/outlet/edit/2013_07_04_133905_outlet_edit.lib.php"); <-- ERROR

ChilkatLog:
  RenameFile:
    DllDate: Dec 12 2012
    UnlockPrefix: XXX
    Username: WS-07:jbu
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
    SshVersion: SSH-2.0-OpenSSH_4.3
    SftpVersion: 3
    oldFilename: /content/outlet/edit/outlet_edit.lib.php
    newFilename: /content/outlet/edit/2013_07_04_133905_outlet_edit.lib.php
    StatusResponseFromServer:
      Request: FXP_RENAME
      InformationReceivedFromServer:
        StatusCode: 2
        StatusMessage: No such file
      --InformationReceivedFromServer
    --StatusResponseFromServer
    Failed.
  --RenameFile
--ChilkatLog

PS: With WinSCP the renaming works, and iam using verision 9.4.0 from Chilkat.

best,

Jörg


Answer

Hi Again,

I have found a solution, just removing the first slash in the old and new filename.

Regards,

Jörg