Ver Mensaje Individual
  #6  
Antiguo 12-02-2008
keyboy keyboy is offline
Miembro
 
Registrado: oct 2004
Posts: 367
Reputación: 20
keyboy Va por buen camino
Cita:
Empezado por dec
Yo sigo a lo mío...
Podemos combinar ideas:

Código Delphi [-]
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;

Bye
Responder Con Cita