RT

解决方案 »

  1.   

    具体:
    if FindFirst(const Path: string; Attr: Integer; var F: 
    TSearchRec) 
    begin
      repeat
        ......  until findnext(F)<>0
    end;
      

  2.   

    searchRec:TsearchRec;
    if (FindFirst(mainpath+'*.*', faDirectory, SearchRec)=0) thenbeginsubdir1.Add(SearchRec.Name);while (FindNext(SearchRec) = 0) dobeginstringList.Add(SearchRec.Name);end;end;
      

  3.   

    searchRec:TsearchRec;
    if (FindFirst(mainpath+'*.*', faDirectory, SearchRec)=0) thenbegin
    while (FindNext(SearchRec) = 0) dobeginstringList.Add(SearchRec.Name);end;
      

  4.   

    //全部语句为:(###为函数名)
    function mform.###(curdir:string):integer;
    var
      sr:tsearchrec;
      FileAttrs: Integer;
      filecount: integer;
    begin
      filecount:=0;  FileAttrs := 0;
      //以下是增加搜索文件的属性,以搜索更多的文件,
      FileAttrs := FileAttrs + faHidden;
      FileAttrs := FileAttrs + faSysFile;
      FileAttrs := FileAttrs + faVolumeID;
      FileAttrs := FileAttrs + faDirectory;
      FileAttrs := FileAttrs + faArchive;
      FileAttrs := FileAttrs + faAnyFile;  if DirectoryExists(curdir)=true then
      begin
        if FindFirst(curdir+'\*.*', fileattrs, sr) = 0 then
        repeat
          begin
              //此处添加对索索文件的操作
          end
        until FindNext(sr) <> 0;
        FindClose(sr);    {$I-}
        rmdir(curdir);
        if ioresult<>0 then
          result:=-2
        else
          result:=filecount;
      end
      else
      begin
        result:=-1;
      end;end;!!!
    特别注意,在删除搜索的子目录时,应该注意两个特别的目录“.”和“..”
    以免将当前目录和上一级目录误删除或造成死锁等错误。
      

  5.   

    我还能说什么,后悔分给少了!
    THANK YOU!