procedure ReadFiles(Path, Mask: String; Lines: TStrings);
var
SearchRec: TSearchRec;
SomeLines: TStringList;
Result: Integer;
begin
Path := ExtractFilePath(Path);
Result := FindFirst(Path + Mask, faAnyFile, SearchRec);
try
if Result = 0 then
begin
SomeLines := TStringList.Create;
try
repeat
SomeLines.LoadFromFile(Path + SearchRec.Name);
Lines.AddStrings(SomeLines);
Result := FindNext(SearchRec);
until Result <> 0;
finally
SomeLines.Free;
end;
end;
finally
FindClose(SearchRec);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ReadFiles('.\', '*.csv', Memo1.Lines);
end;