procedure findall(disk,path: String; var fileresult: Tstrings); 
var 
fpath: String; 
fs: TsearchRec; 
begin 
fpath:=disk+path+'\*.*'; 
if findfirst(fpath,faAnyFile,fs)=0 then 
begin 
if (fs.Name<>'.')and(fs.Name<>'..') then 
if (fs.Attr and faDirectory)=faDirectory then 
findall(disk,path+'\'+fs.Name,fileresult) 
else 
  if UPPERCASE((ExtractFileExt(fs.Name))='.DAT') OR  UPPERCASE((ExtractFileExt(fs.Name))='MPEG') then
    fileresult.add(disk+path+'\'+fs.Name); 
while findnext(fs)=0 do 
begin 
if (fs.Name<>'.')and(fs.Name<>'..') then 
if (fs.Attr and faDirectory)=faDirectory then 
findall(disk,path+'\'+fs.Name,fileresult) 
else 
  if UPPERCASE((ExtractFileExt(fs.Name))='.DAT') OR  UPPERCASE((ExtractFileExt(fs.Name))='MPEG') then
    fileresult.add(disk+path+'\'+fs.Name); 
end; 
end; 
findclose(fs); 
end; var
  fileresult: TStrings;
begin
  fileresult := TStringList.Create;
  try
    findall('C:','', fileresult);
    ……;     //文件路径保存在fileresult中。
  finally
    fileresult.free;
  end;
end;