Entwickler-Ecke

Dateizugriff - Dateien im momentanen Verzeichnis auflisten


sonic159 - Mi 21.02.07 17:15
Titel: Dateien im momentanen Verzeichnis auflisten
Hallo!

Wie kann ich alle Dateien aus einem Ordner in eine ListBox bekommen...?

Danke!
MfG: $on!c


Narses - Mi 21.02.07 17:19

Moin!

Such mal nach den Suche in: Delphi-Forum, Delphi-Library DRIVETOOLS von user profile iconLuckie, damit solltest du weiter kommen. ;)

cu
Narses


sonic159 - Mi 21.02.07 17:33

Hey vielen Dank!
Habs gefunden...

MfG: $on!c


raven_22 - Di 20.03.07 23:46


Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
function DIR (Path:String):Tstringlist;
var tr:TsearchRec;
begin
result := Tstringlist.Create;
FindFirst(Path,faAnyFile,tr);
    while FindNext(tr)=0 do
        begin
        if (tr.Attr and faDirectory > 0then
         result.Add('<DIR> '+tr.Name);
                 if (tr.Attr and faDirectory = 0then
         result.Add(tr.Name);
        end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
listbox1.Items:=DIR('c:\*.*');
end;


LG raven


Calculon - Mi 21.03.07 12:29

Die Filelistbox-Komponente scheint irgendwie nie nennenswert zu sein :gruebel: ; das kapier' ich nicht, weil sie eigentlich genau das tut

Zitat:
alle Dateien aus einem Ordner in eine ListBox


Gruß

Calculon
--