可以使用FindFirst和FindNext函数查找文件,如:
begin
Found := FindFirst("d:\test\*.*", Attr, SearchRec);
while Found = 0 do
begin
//处理找出来的文件
Found := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
TSearchRec类型定义如下:
type
TSearchRec = record
Time : Integer;
Size : Integer;
Attr : Integer;
Name : TFileName;
ExcludeAttr : Integer;
FindHandle : THandle;
FindData : TWin32FindData;
end;