Thema: Delphi Ordner auflisten?

Einzelnen Beitrag anzeigen

Bauer007

Registriert seit: 17. Sep 2007
Ort: Husum
56 Beiträge
 
Delphi XE2 Professional
 
#5

Re: Ordner auflisten?

  Alt 18. Sep 2007, 11:53
Mach bitte _nicht_ nur Copy&Paste!!!

Delphi-Quellcode:
procedure ListeDir(Path: string; FileList: TStrings);
var
  SR: TSearchRec;
begin
  if FindFirst(Path + '*.*', faAnyFile, sr) = 0 then
  begin
    repeat
       if ((sr.Attr and faDirectory) = faDirectory) and
          (sr.Name <> '.') and
          (sr.Name <> '..') then
      begin
        FileList.Add(sr.Name);
      end;
    until FindNext(sr) <> 0;
    FindClose(sr);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ListeDir('C:\Windows\', ListBox1.Items);
end;

ungetestet
Sebastian
  Mit Zitat antworten Zitat