CopyFile

Copies a file to a new location.


Syntax

FileSystem.CopyFile(SourceFile, DestinationFile)

FileSystem.CopyFile(SourceFile, DestinationFile, Overwrite)

FileSystem.CopyFile(SourceFile, DestinationFile, UIOption)

FileSystem.CopyFile(SourceFile, DestinationFile, UIOption, UICancelOption)


Parameters


SourceFile

String, input



The file to be copied.


DestinationFile

String, input



The location to which the file should be copied.


Overwrite

Boolean, input



True to overwrite existing files, otherwise False. Default is False.


UIOption

Enumeration, input



Whether to visually track the operation's progress. Default is OnlyErrorDialogs.


UICancelOption

Enumeration, input



Specifies what should be done if the user clicks Cancel during the operation. Default is ThrowException.


Remarks


UIOption



UIOption.AllDialogs

Show progress dialog box and any error dialog boxes.


UIOption.OnlyErrorDialogs

Only show error dialog boxes and hide progress dialog boxes. Default.


UICancelOption



UICancelOption.DoNothing

Do nothing when the user clicks Cancel.


UICancelOption.ThrowException

Throw an exception when the user clicks Cancel. Default.


Examples

Sub Main()

FileSystem.CopyFile "C:\Users\Public\My Directory\Test.txt", "C:\Users\Public\Test Directory\Test.txt", False

End Sub



Sub Main()

FileSystem.CopyFile "C:\Users\Public\My Directory\Test.txt", "C:\Users\Public\Test Directory\NewTest.txt", UIOption.OnlyErrorDialogs, UICancelOption.DoNothing

End Sub