1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40:
| Procedure FindFiles (aPath, aFindMask: String; aWithSub: Boolean; aResult: tStrings); Var FindRec: tSearchRec; Begin If (aPath = '') or (aFindMask = '') or Not Assigned (aResult) Then Exit;
If aPath[Length (aPath)] <> '\' Then aPath := aPath + '\';
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);
If Not aWithSub Then Exit;
If FindFirst (aPath + '*.*', faAnyFile, FindRec) = 0 Then Repeat If (FindRec.Name <> '.') and (FindRec.Name <> '..') Then If Boolean (FindRec.Attr and faDirectory) Then FindFiles (aPath + FindRec.Name, aFindMask, aWithSub, aResult); Until FindNext (FindRec) <> 0;
FindClose (FindRec); End; |