Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DELPHI How to copy .txt file and rename [closed]

Tags:

delphi

I need to copy a .txt file and rename it.

I am only a beginner, Please help me.

any suggestions and comments will do. THANKS in advance. :)

like image 253
justine yeojson Barcelo Avatar asked Nov 29 '22 22:11

justine yeojson Barcelo


2 Answers

There are numerous ways to copy a file from one location to another, but the most straight-forward method is by using the CopyFile method, located in the Winapi.Windows unit...

CopyFile('C:\OriginalFile.txt', 'D:\NewFile.txt', False);
like image 191
Jerry Dodge Avatar answered Dec 15 '22 01:12

Jerry Dodge


Cross-platform solution

uses System.IOUtils;    
TFile.Copy('file.txt','anotherfile.txt');
like image 39
zawuza Avatar answered Dec 15 '22 00:12

zawuza