Einzelnen Beitrag anzeigen

Andreas L.
(Gast)

n/a Beiträge
 
#8

Re: Leere Verzeichnisse rekursiv löschen

  Alt 7. Mai 2009, 17:42
Ok, jetzt gehts. Vielen Dank

Delphi-Quellcode:
procedure DeleteEmptyDirectories(Path: String);
var
  SearchRec: TSearchRec;
begin
  if FindFirst(IncludeTrailingPathDelimiter(Path) + '*.*', faAnyFile, SearchRec) = 0 then
  begin
    repeat
      if ((SearchRec.Attr and faDirectory) = faDirectory) and (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then
        DeleteEmptyDirectories(IncludeTrailingPathDelimiter(Path) + SearchRec.Name);
    until (FindNext(SearchRec) <> 0);
    FindClose(SearchRec);
  end;
  RemoveDir(Path);
end;
  Mit Zitat antworten Zitat