ups
das vergesse ich immer (egal in welchem forum) *ggg*.
die lösung:
man macht erst ne procedure zum scannen der verzeichnisstruktur und such dann in der gescannten verzeichnisstruktur (zumindest wenn ich das richtig verstanden habe).
Delphi-Quellcode:
procedure Scan(const Path, FileMask: string; FileList: TStrings);
var
SR: TSearchRec;
begin
if FindFirst(Path + FileMask, faAnyFile and not (faDirectory or faVolumeID), SR) = 0 then
try
repeat
FileList.Add(ExpandSlash(Path)+SR.Name);
Application.ProcessMessages;
until FindNext(SR) <> 0;
finally
FindClose(SR);
end;
if FindFirst(Path + '*.*', faAnyFile, SR) = 0 then
try
repeat
if (SR.Attr and faDirectory <> 0) and (SR.Name <> '.') and (SR.Name <> '..') then
Scan(Path + SR.Name + '\', FileMask, FileList);
until FindNext(SR) <> 0;
finally
FindClose(SR);
end;
end;
procedure FindFiles(const Path, FileMask: string; FileList: TStrings);
begin
if Assigned(FileList) and (Path <> '') then
try
FileList.BeginUpdate;
Scan(ExpandSlash(Path), FileMask, FileList);
finally
FileList.EndUpdate;
end;
end;