首页 > delphi > delphi如何获得一个文件夹下所有文件

delphi如何获得一个文件夹下所有文件

2008年5月16日 发表评论 阅读评论

procedure TForm1.Button8Click(Sender: TObject);
var
sr: TSearchRec;
aTempPath: String;
begin
aTempPath :=’D:\delphi\printer\*.*’; //注意后面的*。*一定要加
if FindFirst(aTempPath, faAnyFile, sr) = 0 then
begin
repeat
if (sr.Attr and faArchive) = sr.Attr then
begin
memo1.Lines.Add(‘文件名:’ + sr.Name +
‘大小:’ + IntToStr(sr.Size) +
‘时间:’ + DateTimeToStr(FileDateToDateTime(sr.time))
);
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;

end;

分类: delphi 标签: 2,732 次阅读
原文链接:http://www.wenhq.com/article/view_214.html
欢迎转载,请注明出处:亲亲宝宝
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.