Back to product page

Rename function


Renames a file or directory on the server

Type

A Long value. If successful, 0 is returned, otherwise error as specified here

Syntax

  • C
long Sftp_Rename(void *Sftp, char *NewRemotePath, char *OldRemotePath);
The Rename(void *Sftp,char *NewRemotePath,char *OldRemotePath) syntax has these parts:
void *SftpHandle of the created Sftp instance.
char *NewRemotePathFull path to new file/directory on the server.
char *OldRemotePathFull path to file/directory on the server.

Remarks

This function will rename a file or directory on a remote server, if possible. Once the rename is complete, the Done callback will be invoked. If no error occurs, the ErrorCode argument in the Done callback will be set to 0 (zero). If an error occurs, ErrorCode will hold the number of the error and ErrorText will contain a description of the error.

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

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

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

Platforms

Windows