From Xojo Documentation

Property (As String )
aFolderItem.Name = newStringValue
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.


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, please delete the existing file before renaming. In case of a duplicate name, the LastErrorCode property is set to 105.


Dim f As New FolderItem
f = GetOpenFolderItem("text/plain")
f.Name = "NewFilename"