FolderItem.Name

From Xojo Documentation

Property (As String )
aFolderItem.Name = newStringValue
or
StringValue = aFolderItem.Name

Supported for all project types and targets.

The name of the FolderItem. Changing this name will change the name of the file or folder.

Notes

It will rename files if the user has permission to rename them, they are not in use, and it is not a folder or temporary file. The file must exist in order to be assigned a name.

Renaming fails if another file with same name exists already. In that case, delete the existing file before renaming.

If renaming the file fails for any reason, an IOException will occur.

Example

Var f As New FolderItem
f = FolderItem.ShowOpenFileDialog("text/plain")
f.Name = "NewFilename"