delphi 取得文件夹及下一级文件夹下的文件列表


本文整理自网络,侵删。

 procedure findall(disk,path: String; var fileresult: Tstrings); 
var
fpath,s: 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
fileresult.add(disk+strpas(strupper(pchar(path)))+'\'+strpas(strupper(pchar(fs.Name)))+'('+inttostr(fs.Size)+')');
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 begin
fileresult.add(disk+path+'\'+strpas(strupper(pchar(fs.Name)))+'('+inttostr(fs.Size)+')');
end;
end;
end;
Findclose(fs);
end;

相关阅读 >>

Delphi webbrowser 操作记要

Delphi版本qq木马

Delphi firemonkey的屏幕分辨率hdpi、mdpi、ldpi的差别

Delphi程序常用的公共代码

Delphi正则表达式

Delphi dbnavigator控件的按钮显示成中文

获取 ip138 ip 地址

Delphi 实现对xml文件的读写操作

Delphi 进程防杀之hook api法

Delphi showmodal与show的区别

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



打赏

取消

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

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

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

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

评论

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