做个bat文件,在dos下改吧.
ren 就可以批量改扩展名的.

解决方案 »

  1.   

    假如你是用LINUX的, 只需要1-2个指令便可以了.  Windows(即DOS 7)恐怕不是
    很方便了.
      

  2.   

    1、扫描硬盘分区
    var
    i:Integer;
    vstring:string;
    DTYPE:Integer;
    begin
    For i:=65 to 90 do
    begin
    vString:=Chr(i)+':\'
    DTYPE:=GetDriveType(PChar(vString));
    if DType=DRIVE_FIXED then 
    showmessage('是有效的硬盘分区')
    end;
    end;
    《待续》
      

  3.   

    2、扫描文件
        function ListAllFiles(const MetterPath, FilePath: string; var FileList:
          TStringList): Integer;
        var
          SearchRec: TSearchRec;
          ReValue: Integer;
          CurrentMetterPath: string;
          CurrentFilePath: string;
          FileExt: string;
          FileCaption: string;
        begin
          CurrentFilePath := fcCheckDirectoryFormat(FilePath);
          CurrentMetterPath := fcCheckDirectoryFormat(MetterPath);
          ReValue := FindFirst(CurrentFilePath + '*.*', faAnyFile, SearchRec);
          while ReValue = 0 do
            begin
              if ((SearchRec.Attr and faDirectory) = faDirectory) then
                begin
                  if not ((SearchRec.Name = '.') or (SearchRec.Name = '..')) then
                    begin
                      ListAllFiles(CurrentMetterPath + SearchRec.Name,
                        CurrentFilePath + SearchRec.Name, FileList);
                    end;
                end
              else //普通文件夹
                begin
                  if Pos('.htm', UpperCase(SearchRec.Name)) > 0 then
                    begin
                      FileCaption := fcGetFileCaption(SearchRec.Name, False);
                      FileList.Add(CurrentMetterPath + '/' +
                        FileCaption + '/' + CurrentFilePath + SearchRec.Name);
                    end;
                end;
              ReValue := FindNext(SearchRec);
            end;
          result := FileList.Count;
        end;
      

  4.   

    3、改变后缀名
    RenameFile(FileName, ChangeFileExt(FileName,'.html');
      

  5.   

    搜索并修改保存到文件
    procedure TForm1.Button1Click(Sender: TObject);
    var   s:string;
          f:textfile;
          searchrec:tsearchrec;  
    begin
      AssignFile(F, 'c:\test.txt');  
      Rewrite(F);                    
      FindFirst('c:\*.htm', faAnyFile, SearchRec);
      Label1.Caption := SearchRec.Name + ' is ' + 
    IntToStr(SearchRec.Size) + ' bytes in size';
      while FindNext(SearchRec) = 0 do begin
          Label1.Caption := SearchRec.Name + ' is ' + 
    IntToStr(SearchRec.Size) + ' bytes in size';
          s:=string(Searchrec.Name)+'l';//改名
          append(F);
          writeln(F,s);//保存文件名
      end;
      FindClose(SearchRec);
      PostQuitMessage(0);
      FindClose(SearchRec);
    end;
      

  6.   

    var AvailableDrives :dword;
        AvailableDrives := GetLogicalDrives;
        for i:= 0 to 25 do
          if GetBit(AvailableDrives,i+1)=1 then//如果驱动器存在
          begin
            DrivePath:=Char(Ord('A')+i)+':\';
            if  GetDriveType(pchar(DrivePath)) =  DRIVE_FIXED   then        
    begin
    //硬盘
    end;
          end;
      

  7.   

    文件操作中的几个方法,用 Rich_Zhou(傻乎乎的同舟) 友的,可以
      

  8.   

    获取硬盘分区列表很简单,可以设置一下循环获取从c到z盘的驱动器类型。搜索文件用findfirst、findnext搜索文件列表还有一种更简单的方法,比如搜索所有c盘中的扩展名为.htm的文件并将搜索结果存到C:\filelist.txt中dir/b/s c:\>c:\filelist.txt
      

  9.   

    修改上一贴:dir/b/s c:\*.htm>c:\filelist.txt
      

  10.   

    findfirst and firstnext
    rename
      

  11.   

    unit UnitSearch;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        ListBox1: TListBox;
        procedure Button1Click(Sender: TObject);
      private
        procedure GetDiskInfo;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    //------------------------------------------------------------------------------
    //查找目录下所有文件
    function ListAllFiles(const FilePath: string; var FileList:TStringList): Integer;
    var
      SearchRec: TSearchRec;
      ReValue: Integer;
      CurrentFilePath: string;
      function fcCheckDirectoryFormat(const FilePath:string):string;
      begin
          Result:=FilePath;
          if FilePath[Length(FilePath)]<>'\' then Result:=FilePath+'\';
      end;
    begin
      CurrentFilePath := fcCheckDirectoryFormat(FilePath);
      ReValue := FindFirst(CurrentFilePath + '*.*', faAnyFile, SearchRec);
      while ReValue = 0 do
        begin
          if ((SearchRec.Attr and faDirectory) = faDirectory) then  //文件夹
            begin
              if not ((SearchRec.Name = '.') or (SearchRec.Name = '..')) then
                begin   //递归查找下一个目录
                  ListAllFiles(CurrentFilePath + SearchRec.Name, FileList);
                end;
            end
          else //普通文件夹
            begin
              if ExtractFileExt(UpperCase(SearchRec.Name))='.HTM' then
                begin
                  FileList.Add(CurrentFilePath + SearchRec.Name);
                end;
            end;
          ReValue := FindNext(SearchRec);
        end;
      result := FileList.Count;
    end;//------------------------------------------------------------------------------
    //得到有效的硬盘分区
    procedure TForm1.GetDiskInfo;
    var
      i:Integer;
      vstring:string;
      DTYPE:Integer;
      lst:TStringList;
    begin
      lst:=TStringList.Create;
      try
         Application.ProcessMessages;
         For i:=65 to 90 do
         begin
            vString:=Chr(i)+':\';
            DTYPE:=GetDriveType(PChar(vString));
            if DType=DRIVE_FIXED then ListAllFiles(vString,lst);
         end;
         ListBox1.Items.Assign(lst);
      finally
         lst.Free;
      end;end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      GetDiskInfo;
    end;
      

  12.   

    上面用的是Rich_Zhou(傻乎乎的同舟)的代码,我已经测试通过,不过建议用多线程,因为这个过程实在是太慢,我的赛阳566、256兆内存、20G硬盘、Win2000几度处于死机状态,硬盘框转不停约5分钟才找到50多个文件。
      

  13.   

    我只试过FindFirst这种笨方法!!!
    帮你Up一下!!!