刚好手边有,贴上来供参考:<br><br>//+-------------------------------------------+<br>//| 得到指定路径下的所有文件列表 |<br>//+-------------------------------------------+<br>function Get_File(Path:string):TStrings; //Path就是制定的路径,得到文件的列表以TStrings返回<br>const FileAttrs = faAnyFile and (not fadirectory);<br>var<br> SRec: TSearchRec;<br> FindResult:Integer;<br>begin<br> Result:=TStringList.Create; <br> FindResult:=FindFirst (Path+'/'+'*.*', FileAttrs, SRec);<br> //^^^^^------此处可以进行文件类型的过滤<br> while FindResult= 0 do<br> begin<br> if (SRec.Name <> '.') and (SRec.Name <> '..') then <br> begin<br> Result.Add(SRec.Name);<br> FindResult:=FindNext(SRec);<br> end;<br> end;<br> FindClose (SRec);<br>end;