Home > Language Reference > Classes > VFSVolume
Rename Method
Renames a file or directory.
Syntax
Public Sub Rename(ByRef sOldName As String, ByRef sNewName As String)
| Parameter | Description |
| sOldName | Old Name. |
| sNewName | New 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 SubSee also Expansion cards and the VFSDemo sample.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | Requires an expansion slot. |