SPECIAL OFFER        Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming!

⤷ Remove all files from directory

Use the FindFirst and FindNext functions for searching files in directory. And DeleteFile function for removing files.

procedure TForm1.Button1Click(Sender: TObject);
var
  APath: string;
  MySearch: TSearchRec;
begin
  APath:=Edit1.Text;
  FindFirst(APath+'\*.*', faAnyFile+faReadOnly, MySearch);
  Memo1.Lines.Add(MySearch.Name);
  DeleteFile(APath+'\'+MySearch.Name);
  while FindNext(MySearch)=0 do
  begin
    Memo1.Lines.Add(MySearch.Name);
    DeleteFile(APath+'\'+MySearch.Name);
  end;
  FindClose(MySearch);
end;
Related components
TFileSearch
TFolderMonitor
TFileVersion
More for developers
Databases for Amazon Associates
Amazon Categories
Amazon Nodes