System.IOUtils.TFile.Copy
Delphi
class procedure Copy(const SourceFileName, DestFileName: string);
class procedure Copy(const SourceFileName, DestFileName: string;
const Overwrite: Boolean); overload; static;
C++
static void __fastcall Copy(const System::UnicodeString SourceFileName, const System::UnicodeString DestFileName)/* overload */;
static void __fastcall Copy(const System::UnicodeString SourceFileName, const System::UnicodeString DestFileName, const bool Overwrite)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | System.IOUtils.pas System.IOUtils.hpp |
System.IOUtils | TFile |
Description
Copies a file to a given path.
Use Copy to make a copy of a file. The first form of Copy only accepts a source and destination paths. If the destination path points to an already existing file, Copy raises an exception. The second form of Copy accepts an optional Overwrite parameter. If set to true, the parameter forces the copy operation to continue even if the destination file already exists. The following table lists the parameters expected by this method.
Name | Meaning |
---|---|
SourceFileName |
The path to the file that is copied. |
DestFileName |
The destination path to which the file is copied. |
Overwrite |
Specifies whether the copy operation should proceed even if another one is at the DestFileName path. |
Note: Copy raises an exception if the source file does not exist, the paths are invalid, or the user does not have enough privileges to perform the copy operation.
See Also
Code Examples