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 将被其他窗体遮住的窗体弹到最前面

Delphi 动态数组传递数据示例

Delphi google text to speech api

Delphi隐藏指定程序的托盘图标

Delphi字符串隐藏一法

Delphi 调出windows 系统时间设置对话框

Delphi trayicon1如何把窗体关闭到系统托盘

Delphi 返回整数的四种情况

Delphi 根据进程pid获取程序所在路径的函数

Delphi idtcp上传文件

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



打赏

取消

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

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

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

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

评论

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