具体就像搜:d:/aa/下的文件

解决方案 »

  1.   

    5分真的太少了,我还是帮帮你吧。//得到某一文件夹下所有文件列表的函数 /////////////////////////////////////
    // getFileListFromDir('c:\windows',false,fileList);
                                //c:\windows or c:      ture|false
    procedure getFileListFromDir(dir:string;includeSubDir:boolean;var fileList:TStringList);
    var
      sr:TSearchRec;
      path:String;
    begin
      path:=dir+'\';      //c:\windows\
      dir:=dir+'\*.*';    //c:\windows\*.*
      if findFirst(dir,faanyfile,sr)=0 then
      repeat
      begin
        if (sr.Name<>'.') and (sr.Name<>'..') and ((fileGetAttr(path+sr.Name) and faDirectory)<>faDirectory) then
          fileList.Add(path+sr.Name);
        if (includeSubDir) and (sr.Name<>'.') and (sr.Name<>'..') and ((fileGetAttr(path+sr.Name) and faDirectory)=faDirectory) then
          getFileListFromDir(path+sr.Name,includeSubDir,fileList);
      end;
      until findNext(sr)<>0;
      findClose(sr);
    end;