Home > Language Reference > Classes > VFSVolume

Rename Method

Renames a file or directory.

Syntax

Public Sub Rename(ByRef sOldName As String, ByRef sNewName As String)

ParameterDescription
sOldName Old Name.
sNewNameNew name.

Remarks

The Rename method renames a directory or a file on a card. Like most functionality of this object, calling this method without having previously initialized a valid volume reference in the Reference property will cause a runtime error.

The sOldName argument specifies the file or directory to rename, and should be a full path name, the root folder being designated by "/". If this argument specifies a file, it should not be open.

The sNewName argument specifies the new name for the file or directory and must not contain the filepath. If a file or directory with the same name exists in the directory, a runtime error occurs.

The following example shows how to rename the file "/test00.dat" to "/test01.dat" on the first volume found:

Private Sub Button1_Click()
  Dim v as New VFSVolume

  If v.FindFirstVolume Then
    v.Rename "/test00.dat", "test01.dat"
  Else
    MsgBox "No card inserted"
  End If
End Sub

See also Expansion cards and the VFSDemo sample.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0Requires an expansion slot.