Back to product page

Rename method


Renames file or directory on the server.

Type

Void

Syntax

  • C#
  • VB.NET
public Void Rename(String NewRemotePath);
The Rename(NewRemotePath) syntax has these parts:
NewRemotePathNew name for the file or directory.

public Void Rename(String NewRemotePath, String OldRemotePath);
The Rename(NewRemotePath,OldRemotePath) syntax has these parts:
NewRemotePathNew name for the file or directory.
OldRemotePathOld name of the file or directory.

public Sub Rename(ByVal NewRemotePath As String)
The Rename(NewRemotePath) syntax has these parts:
NewRemotePathNew name for the file or directory.

public Sub Rename(ByVal NewRemotePath As String, ByVal OldRemotePath As String)
The Rename(NewRemotePath,OldRemotePath) syntax has these parts:
NewRemotePathNew name for the file or directory.
OldRemotePathOld name of the file or directory.

Remarks

This method will rename file or directory in remote server, if possible. Once completed, Done event will be fired. If no error occurs, Error argument in Done event will be set to null. If error occurred, Error will contain description for the error.

If you don't specify OldRemotePath argument, then wodSFTP.NET will use value of RemotePath property for this method.

Even UNIX (and windows in last few versions) have same command for renaming and moving (which is in fact MOVE command), you cannot be sure that this command will also move files from one directory to another. This depends only on server-side implementation of SFTP protocol.

No wildcards can be used for RemotePath argument. RFC protocol specification for SFTP does not allow them.

Platforms

Windows