Back to product page

Rename method


Renames a file or directory on the server.

Type

None

Syntax

  • Basic
object.Rename NewRemotePath, [OldRemotePath]
The Rename(object,NewRemotePath,OldRemotePath) syntax has these parts:
objectAn expression evaluating to an object of type wodSFTP.
NewRemotePathRequired. A String value. Full path to a new file/directory on the server.
OldRemotePathOptional. A Variant value. Full path to a file/directory on the server.

Remarks

This method will rename a file or directory on the remote server, if possible. Once completed, the Done event will be fired. If no error occurs, the ErrorCode argument in the Done event will be set to 0 (zero). If an error occurs, ErrorCode will hold the number of the error and ErrorText will contain a description for the error.

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

Even though UNIX (and recent versions of Windows) has the same commands for renaming and moving (i.e. the MOVE command), you cannot be sure that this command will also move files from one directory to another. This depends on the server-side implementation of the SFTP protocol.

No wildcards can be used for the NewRemotePath or OldRemotePath arguments. The RFC protocol specification for SFTP does not allow them.

Platforms

Windows