0 votes
by (120 points)

Hi,

I'm facing some issue with the Rebex.Net.SFtp.Rename method in a PowerShell script.
It fails with the error message "Exception when calling 'Rename' with '2' argument(s): 'Failure; Failure." when the file, to be moved from an SFTP directory to another, already exists in the destination directory with the same name.

Rebex.Sftp.dll :

  • File Description : Rebex SFTP (2020 R3) for .Net 4.0-4.8
  • File version : 5.0.7501.0

Regards,
I.T.

Applies to: Rebex SFTP

1 Answer

0 votes
by (144k points)

Hi,

This error comes from the SFTP server, which rejected SFTP client's rename request with an error message of "Failure" and an SFTP error code "SSHFXFAILURE" indicating generic failure.

The SFTP protocol's rename operation is actually supposed to fail when the destination file already exists, which means that the observed behavior is correct, (even though the generic error message is not informative at all).

...