2,507
社区成员




procedure GetSubFiles(Path,Ext:string; var List:TStringList);
var
n: Integer;
F: TSearchRec;
begin
if Path[Length(Path)] <> '\' then Path:=path+'\';
n:=FindFirst(Path+'*.*',63,f);
while n=0 do
begin
Application.ProcessMessages;
if ((f.Name)[1] <> '.') then
begin
if Copy(F.Name,Length(f.Name)-(length(ext)-1),Length(ext)) =ext then List.Add(Path+f.Name);
if f.Attr=faDirectory then GetSubFiles(Path+f.Name,ext,List);
end;
n:=FindNext(f);
end;
end;
看这个 函数把递归把所有类型文件返回到一个列表内 你再遍历这个列表看看文件在不再就好了