delphi如何获得一个文件夹下所有文件
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,801 次阅读
原文链接:http://www.wenhq.com/article/view_214.html欢迎转载,请注明出处:亲亲宝宝