Habe hier eine Funktion die mir alle Elemente eines Ordners auflistet (Dateien und Ordner). Jetzt möchte ich aber nur die Dateien und nicht auch noch die Ordner. Hier mal die Funktion:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
| procedure FindFiles (aPath, aFindMask: String; aWithSub: Boolean; aResult: tStrings); Var FindRec: tSearchRec; Begin If FindFirst (aPath + aFindMask, faAnyFile, FindRec) = 0 Then Repeat If (FindRec.Name <> '.') and (FindRec.Name <> '..') Then aResult.Add (aPath + FindRec.Name); Until FindNext (FindRec) <> 0; FindClose (FindRec); end; |
Aufrufen tut man sie so z.B.:
FindFiles ('Pfad','*.*', True, ListBox1.Items);
Moderiert von
raziel: Delphi-Tags hinzugefügt