procedure TForm1.FindAll(Path: String);<br>var<br> sr:TSearchRec;<br> fr:Integer;<br>begin<br>if length(path) <> 3 then<br> Path := path+'/*.*'<br> else<br> Path := path+'*.*';<br>fr:=FindFirst(Path,faAnyFile,sr);<br>while fr=0 do<br> begin<br> //处理文件<br> if pos('txt',sr.name)>0 then<br> showmessage(sr.name);<br> fr:=FindNext(sr);<br> end;<br>FindClose(sr);<br>end;