Xojo.IO.FolderItem.MoveTo

From Xojo Documentation

Method

Xojo.IO.FolderItem.MoveTo(destination As Xojo.IO.FolderItem)

Supported for all project types and targets.

Moves the FolderItem to the specified destination Folderitem.

Notes

This method does a move rather than a copy even when the source is on a different volume than the destination. After the move, the Exists property of the original FolderItem is False.

If the source FolderItem is a folder, then the folder and all its contents are recursively copied.

The destination parameter is a file, not a folder.

Exceptions

  • RuntimeException if the FolderItem could not be moved, for example if the destination is a file and it already exists.

Sample Code

Move a file to a new location:

Using Xojo.IO
Var sourceFile As FolderItem = SpecialFolder.Documents.Child("MyFile.txt")

If sourceFile.Exists Then
Var destFile As FolderItem = SpecialFolder.ApplicationSupport.Child(sourceFile.Name)
sourceFile.MoveTo(destFile)
End If