FolderItem.MoveFileTo

From Xojo Documentation

Method

FolderItem.MoveFileTo(Destination as FolderItem)

Supported for all project types and targets.

Moves the FolderItem to the path specified by Destination.

Notes

It does a move rather than a copy even when the source file is on another volume. After the move, the original file no longer exists. See the example of MoveFileTo in the Examples section for FolderItem. If there is an error, the LastErrorCode property contains an error code.

Example

This example uses MoveFileTo. The source file will be deleted and moved into the destination folder.

Dim f, g As FolderItem
f = GetOpenFolderItem(FileTypes1.Text)
If f <> Nil Then // if the user didn’t cancel..
If f.Exists Then // if it is a valid file...
g = Volume(0).Child(f.Name)
If g <> Nil Then
f.MoveFileTo(g)
MsgBox("success!")
End If
End If
Else
MsgBox("File not found!")
End If