delphi 查找某目录下的特定文件


本文整理自网络,侵删。

 procedure ChangeDir(dir: string; SL: TStringList);
var
SearchRec : TSearchRec;
Attr : integer;
Found : integer;
ExtFileName:string;
temstr:string;
begin
SL.Clear;
//查找该目录下所有*.jpg的文件,并将文件路径及文件名添加到SL
temstr:=dir+'\*.jpg';
Attr := faAnyFile;
Found := FindFirst(temstr, Attr, SearchRec);
while Found = 0 do
begin
//获取扩展名
//ExtFileName:=LowerCase(ExtractFileExt(SearchRec.Name));
try
SL.Add(dir+'\'+SearchRec.Name);
except
end;
Found := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;

相关阅读 >>

Delphi实现url编码解码函数

Delphi google text to speech api

Delphi多线程图片转换类实现

Delphi 常用api 函数

Delphi xe中windows7新的taskbar功能的使用

orangeui作者开源作品

Delphi 禁止关机的代码

Delphi xe7中stringgrid组件的使用

Delphi使用tnethttpclient:重定向后如何给出最终的url?

Delphi 如何判断可见字符 unicode

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...