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 tstrings类的一些技巧

Delphi动态创建组件,并释放内存

Delphi 取得txt文件编码

Delphi 程序启动窗体控制在桌面右下角

Delphi 使用并行库中的ttask

Delphi多级指针

Delphi 自动填表代码

Delphi防止同时出现多个应用程序实例

Delphi 窗体内控件实现滚动字母

Delphi xe android将域名转化为ip

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



打赏

取消

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

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

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

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

评论

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