RenameFile Method

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

Syntax

object.RenameFile(OldFileName, NewFileName)

The object placeholder represents an expression that evaluates to a FileTransfer object.

Return Type

Integer

Remarks

The RenameFile method renames an existing file on the remote host to the new name.

Note that you must have permission to change the file name or an error will occur.

The OldFileName argument specifies the current name of the file on the remote host.

The NewFileName argument specifies the name that the existing file will be changed to.

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.

Example

Private Sub cmdRename_Click()
    Dim nError As Long
    
    nError = FileTransfer1.RenameFile(strOldFileName, strNewFileName)
    If nError <> 0 Then
        MsgBox "Rename File error: " & nError
    End If
    UpdateResult
End Sub

See Also

DeleteFile Method


Copyright © 2008 Catalyst Development Corporation. All rights reserved.