



Este exemplo demostra a cópia, movimentação e exclusão de arquivos através
dos métodos da classe TFile.
É necessário declarar System.IOUtils.
Exemplo:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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; |
Fonte: http://docwiki.embarcadero.com/CodeExamples/Tokyo/en/FileOperations_(Delphi)