批量修改多个 *.asp 的相同文字。有一个A\x\k\a.asp
A\y\b.asp
A\z\m\\n\c.asp
....   想把*.asp里面共同的  '文字  '  全部改为  ‘ 我的东东’。
请高手帮帮忙。

解决方案 »

  1.   

    一个一个文件读取替换好了。
    用Tstringlist读取后,replace好了。。
      

  2.   

    你需要用到两个函数,第一个:批量搜索指定目录下的所有asp文件
    procedure TForm1.FindFiles(Apath:string);
    var
        FSearchRec,DSearchRec:TSearchRec;
        FindResult:integer;
    begin
        if apath[length(apath)]<>'\' then apath:=apath+'\';
        FindResult:=FindFirst(Apath+'*.asp',faAnyFile+faHidden+faSysFile+faReadOnly,FSearchRec);
        try
           while FindResult=0 do
           begin
               ListBox1.Items.Add(Apath+FSearchRec.Name);
               FindResult:=FindNext(FSearchRec);
           end;
           FindResult:=FindFirst(Apath+'*.*',faDirectory,DSearchRec );
           while FindResult =0 do
           begin
               if ((DSearchRec.Attr and fadirectory)=fadirectory) and (leftstr(DSearchRec.Name,1)<>'.') then
                   FindFiles(Apath+DSearchRec.Name);
               FindResult:=FindNext(DSearchRec );
           end;
        finally
           FindClose(FSearchRec);
        end;
    end;
    第二个,替换文件里的内容
    uses strutils;st:tstringlist;
    st:=tstringlist.create;
    st.loadfromfile('A\x\k\a.asp');
    st.text:=ansireplacetext(st.text,'文字,'我的东东');
    st.free;另外,技术贴子最好不要发在非技术区。不过对我来说赚点水分也是好的,呵呵
      

  3.   

    dreamweaver里面 就有啊  不用自己专门 开发软件吧??