本文整理自网络,侵删。
procedure FileSearch(const PathName, FileName : string) ; var Rec : TSearchRec; Path : string; begin Path := IncludeTrailingPathDelimiter(PathName) ; if FindFirst (Path + FileName, faAnyFile - faDirectory, Rec) = 0 then try repeat ListBox1.Items.Add(Path + Rec.Name) ; until FindNext(Rec) <> 0; finally FindClose(Rec) ; end;{
用法:FileSearch('C:\Users\Desktop\_recovery','*.ini'); 获取指定扩展名文件
用法:FileSearch('C:\Users\Desktop\_recovery','*.*'); 获取所有文件
}
end;
相关阅读 >>
Delphi 快速获取文件大小(使用_lopen和fileseek,此函数可以快速获取文件大小,即使文件已经被其它程序锁定)
Delphi �c 如何使用datasnap获取作为标头传递的标记?
Delphi xe实现android 添加图片资源到应用并使用它
更多相关阅读请进入《Delphi》频道 >>