FileCopy

Declaration: FileCopy(SourceName, DestName: string; RemoveReadOnly: boolean): integer;
The function FileCopy copies the file SourceName to the file DestName. The path of the destination file must exist (use ForceDirectories to create a new folder). If the parameter RemoveReadOnly is TRUE the read-only attribute is reset in the destination copy (i.e. when copying a file from CDROM the read-only attribute is not transferred to the harddisk).

On return, the function FileCopy delivers the following error codes:

 0 ... no error
-1 ... no such sources file
-2 ... cannot create destination file
-3 ... write error during copying
-4 ... read error during copying

Hint: If the parameter DestName contains an existing directory (instead of the destination file name) the file name of the SourceName is extracted and automatically appended to DestName.


Last Update: 2020-Apr-22