delphi中如何实现模糊查找文件

 
procedure   GetFilenames(sPath,   sFilename:   String;     AList:   TStrings);
//功能描述:   列出sPath目录中(不含子目录)所有文件名符合sFilename规则的文件名
//入口参数:
//     sPath           -   目录路径
//     sFilename   -   文件名
//出口参数:
//     AList           -   sPath目录中所有符合的文件名被添加到了这一列表中
var
   SR   :   TSearchRec;
begin
   if   FindFirst(sPath   +   sFilename,   faReadOnly   +   faHidden   +   faSysFile   +  faArchive   +   faAnyFile,   SR)   =   0   then
   begin
       repeat
           AList.Add(sPath   +   SR.Name);
       until   FindNext(SR)   <>   0;
       FindClose(SR);
   end;
end;

调用举例:   在ListBox1中列出   d:aaa*.*
GetFilenames   ( 'd: ',   'aaa*.* ',   ListBox1.Items);
原文地址:https://www.cnblogs.com/plug/p/4557469.html