delphi 批量删除同类文件的函数


本文整理自网络,侵删。

 批量删除同类文件的函数
procedure DelFiles(f: string);
var
SearchRec: TSearchRec;
begin
ChDir(ExtractFilePath(f)); //进入文件路径
FindFirst(f, faAnyFile, SearchRec);
repeat
if FileExists(SearchRec.Name) then
begin
//FileSetAttr(SearchRec.Name,0); //修改文件属性为普通属性值
DeleteFile(SearchRec.Name); //删除文件
end;
until(FindNext(SearchRec)<>0);
FindClose(SearchRec);
end;

相关阅读 >>

Delphi 调用dll文件中的form

Delphi 系统日期时间格式设置

Delphi tarray<tarray<string>> 用法

Delphi xe10 创建匿名线程

Delphi ios取设备唯一值

Delphi listview 与数据库连接

检测是否按下键盘或鼠标,如果超过5分钟没有操作则认为用户已经离开

Delphi xe7 新的并行库 system.threading

Delphi xe 中使用正则表达式

Delphi dll窗体调用解

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



打赏

取消

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

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

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

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

评论

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