procedure DeleteDir1();
var
DirInfo: TSearchRec;
r: integer;
begin
r := FindFirst('C:\Download\*.*', FaAnyfile, DirInfo);
while r = 0 do begin
if ((DirInfo.Attr and FaDirectory <> FaDirectory) and
(DirInfo.Attr and FaVolumeId <> FaVolumeID))
then
if not DeleteFile(pChar('C:\Download\' + DirInfo.Name)) then
ShowMessage('Unable to delete: C:\Download\'+DirInfo.Name);
r := FindNext(DirInfo);
end;
SysUtils.FindClose(DirInfo);
if not RemoveDirectory('C:\Download\') then
ShowMessage('Unable to delete directory: C:\Download\');
end;