CopyTo(Destination: String; Overwrite: Boolean);
Destination — a path that corresponds to a directory into which a file should be copied.
Overwrite — a parameter that determines whether a file is overwritten if there is a file with the same name in a directory Destination. If the passed value is True the file is overwritten. If the passed value is False and the file already exists, an exception is generated.
The CopyTo method copied a file to a directory passed by the Destination parameter.
Sub Main;
Var
FileInf: IFileInfo;
Begin
FileInf:=New FileInfo.Attach("c:\Work\1.txt");
If FileInf.Exists And Directory.Exists("c:\Temp") Then
FileInf.CopyTo("c:\Temp", True);
End If;
Dispose FileInf;
End Sub Main;
After executing this example, a file is copied into a directory c:\Temp.
See also: