美文网首页
2019-06-19 文件内容合并器

2019-06-19 文件内容合并器

作者: netppp | 来源:发表于2019-06-19 10:25 被阅读0次

unit Unit1;

interface

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls;

type

  TForm1 = class(TForm)

    Button1: TButton;

    Memo1: TMemo;

    OpenDialog1: TOpenDialog;

    Memo2: TMemo;

    Button2: TButton;

    Edit1: TEdit;

    Label1: TLabel;

    procedure Button1Click(Sender: TObject);

    procedure Button2Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

var

  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

var

x: TextFile;

m,n:string;

i:integer;

begin

  //  if opendialog1.execute  then

  //  filePath:=opendialog1.FileName;

  //  showmessage(filepath.text);

  //  memo1.lines.loadfromfile(filePath);

  //  edit1.text:=filePath;

  // RenameFile('C:\222.txt', 'C:\222.txt');

  // CopyFile(PChar('C:\222.txt'), PChar('C:\22234.txt'), true);

  // MoveFile('C:\ph\update.exe', 'C:\update.exe');

  // DeleteFile('C:\ph\222.txt');

// AssignFile(x, 'C:\3.txt');

  //Rewrite(x);//创建文件,或者使用ReSet打开文件

  //Writeln(x, edit1.text);

  //CloseFile(x);

      for  i:=0 to memo2.lines.count-1 do

    begin

        n:=memo2.lines[i];

        AssignFile(x,edit1.text+'\'+n);

        reset(x);

        while  not  eof(x) do

        begin

        readln(x,m);

        memo1.Lines.add(m);

        end;

      end;

end;

function Searchfile(path: string): TStringList;

var

  SearchRec: TSearchRec;

  found: integer;

begin

  Result := TStringList.Create;

  found := FindFirst(path + '\' + '*.*', faAnyFile, SearchRec);

  while found = 0 do

  begin

    if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') and

      (SearchRec.Attr <> faDirectory) then

      Result.Add(SearchRec.Name);

    found := FindNext(SearchRec);

  end;

  FindClose(SearchRec);

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

  Memo2.Lines := Searchfile(edit1.text);

end;

end.

相关文章

  • 2019-06-19 文件内容合并器

    unit Unit1; interface uses Windows, Messages, SysUtils, ...

  • Linux将多个文件内容合成一个

    把两个文件的内容合并成一个文件 如果想把整个文件夹的log文件合并成一个文件 将多个文件内容合成一个的应用场景 当...

  • iOS 中SDK开发注意事项

    终端命令: 真机和模拟器上的库文件合并 Framework库合并的是Framework内包含的二进制文件,合并后替...

  • 文本处理命令

    1、查看文件内容 ①cat查看及合并 命令:cat 作用:查看文件内容 语法:#cat 文件名称 ②more分屏...

  • Git 单文件还原

    场景 合并远程分支代码时和本地的某个文件有冲突 这时我有三个选择: 手动合并 以本地文件为主 以服务器文件为主 经...

  • Linux学习笔记-文本操作(2) 2018-05-08

    echo--响应、创建文件 more--显示文件内容 cat--显示文件内容,合并文件 less--在新窗口查看文...

  • 每日一个linux命令09-cat

    1. 命令解析 命令用途: 显示整个文件的内容; 创建一个新文件,并从键盘向文件输入内容; 将几个文件的内容合并到...

  • (10) cat 命令

    命令格式 cat [参数] 文件 命令功能 显示文件内容,创建新文件,文件合并 常用参数 cat --help 常...

  • 如何合并多个pdf文件?两个方法总有你喜欢的

    合并PDF文件在工作中是非常有必要的,而对于文件的合并,通常有两种选择。 一:将文件内容移动到另一个文件。 二、利...

  • ijkMediaPlayer编译集成

    1.下载安装编译ffpm(略) 2.合并模拟器和真机framework 文件,合并的是IJKMediaFramew...

网友评论

      本文标题:2019-06-19 文件内容合并器

      本文链接:https://www.haomeiwen.com/subject/ebrhqctx.html