Xojo.IO.FolderItem.CopyTo

From Xojo Documentation

Method

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

Supported for all project types and targets.

Copies the FolderItem to the specified destination Folderitem.

Notes

If destination is a folder, then the FolderItem is copied into the folder.

If destination is a file and the file exists, the copy is cancelled and a RuntimeException is raised. You'll need to first delete the destination file before copying the original.

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

Exceptions

Sample Code

Copy a file:

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

If sourceFile.Exists Then
Var destFile As FolderItem = SpecialFolder.Documents.Child(sourceFile.Name + " copy")
sourceFile.CopyTo(destFile)
End If