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 comobj调用wmplayer播放音乐

Delphi 2009 indy10 idhttp get 中文出现乱码的问题

Delphi memo1自动循环上下滚屏

Delphi 利用unigui中的tunipagecontrol实现多页面

Delphi怎么样选择pagecontrol1的分页

Delphi指针

Delphi 自带大小写转换

Delphi 如何获得其他进程的token

Delphi工具之tdump

Delphi 一个call应该如何写?

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



打赏

取消

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

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

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

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

评论

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