SSH.SFTPSession.Rename - charonn0/RB-libssh2 GitHub Wiki
SSH.SFTPSession.Rename
Method Signatures
Sub Rename(SourceName As String, DestinationName As String, Overwrite As Boolean = False)
Function Rename(SourceName As String, DestinationName As String, Overwrite As Boolean = False) As String
Function Rename(SourceName As String, DestinationName As String, Overwrite As Boolean, Atomic As Boolean, SysCalls As Boolean) As String
Parameters
Rename(String, String, Boolean)
| Name | Type | Comment |
|---|---|---|
SourceName |
String | The path to the remote file to be renamed. |
DestinationName |
String | The new path for the file. |
Overwrite |
Boolean | Optional. If True, the destination file will be overwritten if it exists. |
Rename(String, String, Boolean, Boolean, Boolean)
| Name | Type | Comment |
|---|---|---|
SourceName |
String | The path to the remote file to be renamed. |
DestinationName |
String | The new path for the file. |
Overwrite |
Boolean | If True, the destination file will be overwritten if it exists. |
Atomic |
Boolean | If True, the server is requested to perform an atomic rename operation. |
Syscalls |
Boolean | If True, the server is requested to perform the rename using native system calls. |
Return value
The version that returns a string will return the normalized DestinationName on success, and the normalized SourceName on error.
Remarks
Renames the specified file or directory on the remote server using SFTP. Check SFTPSession.LastError to determine whether the rename operation succeeded.
Path normalization
A "normalized" path is one that has been transformed to comply with SFTP's conventions, for example by prepending the WorkingDirectory string if the original input appears to be a relative path.
The normalized DestinationName may be used in subsequent operations to refer to the renamed file. The normalized SourceName is the literal string value of the path as it was sent over the wire, which may be useful in case of error.