Files.Copy

Top  Previous  Next

 

Syntax

function Files.Copy(Source: string; Dest: string; FailIfExists: boolean): boolean

 

Alternative Names

ibec_CopyFile

 

Description

Copies a file identified by Source to a new location or file-name Dest. Both values can include path or drive information. If no path information is included, the current working directory is assumed.

 

The routine will fail if the destination file exists when FailIfExist is TRUE, if this is FALSE, the destination file is overwritten.

 

Returns FALSE on failure, you can use Shell.GetLastError for more information.

 

See also

Files.Move
Files.Rename
Files.GetCurrentDir
Shell.GetLastError
Shell.GetLastErrorMessage

 

Example

execute udsblock 

as

begin

  Files.Copy('c:\temp\testfile.txt', 'c:\temp\testfile_copy.txt', __false);

 

  if Files.FileExists('c:\temp\testfile_copy.txt')

  then GUI.ShowMessage('Copy successful.');

  else GUI.ShowMessage('Copy failed.');

end