[code lang=”delphi”]procedure DelTree(StartDir: string);
var
Search : TSearchRec;
begin
if Startdir[Length(Startdir)] <> ‘\’ then
startdir := startdir + ‘\’;
if FindFirst(startdir + ‘*.*’, faAnyFile, Search) = 0 then
repeat
if (Search.Name[1] <> ‘.’ ) then
if ((Search.Attr and faDirectory) > 0) then
begin
RmDir(StartDir + Search.Name);
ChangeFAttrib(StartDir + Search.Name);
end else
begin
DeleteFile(StartDir + Search.Name);
Application.ProcessMessages;
end;
until FindNext(Search) <> 0;
FindClose(Search);
end;
[/code]
[tags]Delphi, File[/tags]
0 Kommentare zu “Deltree”