Autor Beitrag
greyhound
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: So 07.11.04 10:43 
Hallo Forum,

ich möchte alle Dateien einer Festplatte mit einer bestimmten Endung wie .mp3 auflisten.

Bisher benutze ich die findfirst/findnext routine in einer rekursiven Prozedur, das dauert aber bei 20.000 Dateien ewig.

Gibt es einen schnelleren Weg (vielleicht über die FAT?)
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 07.11.04 10:51 
Hi,

Soweit ich weiß nutzen FindFirst und Co den FAT. Außerdem dauert es gar nicht so lange - du musst zB beachten, dass du unbedingt Items.BeginUpdate verwendest beim Suchen.

AXMD
greyhound Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: So 07.11.04 11:57 
Wie muss ich Items.BeginUpdate einsetzen?
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 07.11.04 12:04 
zB

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
ListView1.Items.BeginUpdate;
ListView1.Clear;
//...Dateisuche...
ListView1.Items.Add(rec.Name);
//...was du halt sonst noch machst...
ListView1.Items.EndUpdate;


ganz einfach ^^

AXMD
greyhound Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: So 07.11.04 12:19 
ich speichere die Dateinamen in einer TStringList, muss ich auch hier mit Items.BeginUpdate arbeiten?
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 07.11.04 12:24 
Das kommt ganz darauf an, ob es nur eine Stringlist ist oder eine StringList, die Property eines Objekts (zB einer ListBox, eines Memos etc.) ist. Wenn letzteres zutrifft: ja; sonst nein.

AXMD
greyhound Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: So 07.11.04 12:36 
Danke für die Hilfe.