procedure TForm1.GetFile(spath:String);
var
sr:TSearchRec;
begin
if FindFirst(sPath,faAnyFile,sr)=0 then
repeat
if (sr.Name='.') or (sr.Name='..') then continue
else if ((sr.Attr and faDirectory)=sr.Attr) then continue//目录
else if ((sr.Attr and faArchive)=sr.Attr) then //文件
if UpperCase(copy(sr.name,lenth(sr.name)-3,4))='.TXT' then //找到
until FindNext(sr)<>0 ;
FindClose(sr);
end;