Immer noch zuviel doppelt.
Delphi-Quellcode:
procedure TMainSuche.FileSearch(const PathName, FileName: string);
var Rec : TSearchRec;
Path : string;
begin
Path := IncludeTrailingBackSlash(PathName);
try
if FindFirst (Path + FileName, faAnyFile, Rec) = 0 then
begin
repeat
if ((Rec.attr and faDirectory) = faDirectory) then
begin
if Checkbox1.Checked then
FileSearch(Path, Rec.Name)
end
else
Listbox1.Items.Add(Path + Rec.Name);
until FindNext(Rec) <> 0;
finally
FindClose (Rec);
end;
end;