RenameFile Method  
 

Change the name of an existing file on the FTP server.

Syntax

object.RenameFile(OldFileName, NewFileName)

Parameters

OldFileName
A string value that specifies the current name of the file on the server.
NewFileName
A string value that specifies the name that the existing file will be changed to.

Return Value

A value of zero is returned if the method succeeds. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The RenameFile method renames an existing file on the server to the new name. You must have permission to change the file name or an error will occur.

Example

nError = FileTransfer1.RenameFile(strOldFileName, strNewFileName)
If nError > 0 Then
    MsgBox FileTransfer1.LastErrorString
End If

See Also

DeleteFile Method