本文整理自网络,侵删。
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 winapi: getdesktopwindow - 返回桌面窗口的句柄
Delphi中使用内联变量(inline variables) 的5个理由
Delphi webservice 中采用 tsoapattachment 传输文件
android实例-拍摄和分享照片、分享文本(xe8+小米2)
Delphi xe5 android 使用system.zip单元释放资源文件
Delphi 莫名奇妙的错误 Delphi is not a valid integer value
更多相关阅读请进入《Delphi》频道 >>