2006. május 20., szombat

Delete a folder with all files in it


Problem/Question/Abstract:

How to delete a folder with all files in it

Answer:

procedure DeleteFolder(Dir: string);
var
  fos: TSHFileOpStruct;
begin
  ZeroMemory(@fos, SizeOf(fos));
  fos.wFunc := FO_DELETE;
  fos.fFlags := FOF_SILENT or FOF_NOCONFIRMATION;
  fos.pFrom := PChar(Dir + #0);
  if ShFileOperation(fos) = 0 then
    ShowMessage('Successful');
end;

Nincsenek megjegyzések:

Megjegyzés küldése