FileOperations (Delphi)
Description
This example demonstrates the copying, moving and deleting of files provided by methods of TFile class.
Code
procedure TForm1.operations(Sender: TObject);
begin
try
{ Copy file from source file path to destination file path }
if Sender = btnCopy then
TFile.Copy(edSourcePath.Text, edDestinationPath.Text);
{ Move file from source file path to destination file path }
if Sender = btnMove then
TFile.Move(edSourcePath.Text, edDestinationPath.Text);
{ Delete file from source file path }
if Sender = btnDelete then
TFile.Delete(edSourcePath.Text);
except
MessageDlg('Incorrect path', mtError, [mbOK], 0);
Exit;
end;
end;
Uses
- System.IOUtils.TFile.Copy ( fr | de | ja )
- System.IOUtils.TFile.Move ( fr | de | ja )
- System.IOUtils.TFile.Delete ( fr | de | ja )