function TForm1.GetAllFile(const Path: string;FileEx:string = '*.*'): TStringList;
var
f: TSearchRec;
Ret: Integer;
begin
FileEx := UpperCase(FileEx);
Result := TStringList.Create;
Ret := FindFirst(Path + '*.*', faAnyFile, f);
while Ret = 0 do
begin
if f.Attr = faDirectory then
begin
if (f.Name <>'.') and (f.Name <> '..') then
GetAllFile(Path + f.Name)
end
else
if UpperCase(ExtractFileExt(f.Name)) = FileEx then
Result.Append(Path + f.Name);
Ret := FindNext(f)
end;
FindClose(f)
end;