Mega Code Archive

 
Categories / Delphi / Files
 

Copy files

Title: copy files? { The CopyFile function copies an existing file to a new file. CopyFile( lpExistingFileName : PChar, // name of an existing file lpNewFileName : PChar, // name of new file bFailIfExists : Boolean); // operation if file exists bFailIfExists: Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds. } var fileSource, fileDest: string; begin fileSource := 'C:\SourceFile.txt'; fileDest := 'G:\DestFile.txt'; CopyFile(PChar(fileSource), PChar(fileDest), False); end;