Mega Code Archive

 
Categories / Delphi / Files
 

Delete all files within directory

Title: Delete all files within directory Use FileListBox component. Specify a necessary directory to this component and remove files by using DeleteFile procedure. procedure TForm1.Button1Click(Sender: TObject); var i: Integer; begin for i:=0 to FileListBox1.Items.Count-1 do DeleteFile(FileListBox1.Items[i]); FileListBox1.Update; end;