SocketTools .NET Edition

FtpClient.RenameFile Method 

Change the name of a file on the server.

[Visual Basic]
Public Function RenameFile( _
   ByVal oldName As String, _
   ByVal newName As String _
) As Boolean
[C#]
public bool RenameFile(
   string oldName,
   string newName
);

Parameters

oldName
A string that specifies the name of the file to be renamed on the server. The file must exist on the server, otherwise an error will be returned.
newName
A string that specifies the new name for the file on the server. The naming conventions used for the file must be compatible with what is used on the operating system that hosts the server. Note that some servers may not permit you to rename the file if a file with the new name already exists.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The RenameFile method changes the name of an existing file on the server to a new name. Note that you must have permission to rename the file or an error will occur. On UNIX based systems this means that you must have write permission to the directory where the file is being renamed.

See Also

FtpClient Class | SocketTools Namespace