function ReadTextFiles(path,
extension: string): string;
function FileToStr(
path: string): string;
var
aFile: TextFile;
begin
AssignFile(aFile, path);
Reset(aFile);
while not Eof(aFile) do
ReadLn(aFile, result);
CloseFile(aFile);
end;
var
sr: TSearchRec;
begin
result := EmptyStr;
path := ExtractFilePath(path);
if FindFirst(path + extension,
faAnyFile, sr) = 0 then begin
try
repeat
result := Concat(
result, FileToStr(path + sr.Name)
);
until (FindNext(sr) <> 0);
finally
FindClose(sr);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(
ReadTextFiles('.\', '*.csv')
);
end;