uses
StrUtils;
function MakeFileList(Path, FileExt: string): TStringList;
var
  sch: TSearchrec;
begin
  Result := TStringlist.Create;

  if (rightStr(trim(Path), 1)) <> '/' then
    Path := trim(Path) + '/'
  else
    Path := trim(Path);

  if not DirectoryExists(Path) then
    begin
      Result.Clear;
      exit;
    end;

  if FindFirst(Path + '*', faAnyfile, sch) = 0 then
    begin
      repeat
        Application.ProcessMessages;
        if ((sch.Name = '.') or (sch.Name = '..')) then Continue;
        if DirectoryExists(Path + sch.Name) then
          begin
            Result.AddStrings(MakeFileList(Path + sch.Name, FileExt));
          end
        else
          begin
            if (UpperCase(extractfileext(Path + sch.Name)) = UpperCase(FileExt)) or (FileExt = '.*') then
              Result.Add(Path + sch.Name);
          end;
      until FindNext(sch) <> 0;
      SysUtils.FindClose(sch);
    end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  i, d: integer;
  St, Sr: TstringList;
  s, t: string;
begin
  St := TstringList.Create;
  Sr := TstringList.Create;
  s := DriveComBOBox1.Items.DelimitedText;
  St.DelimitedText := s;
  try
    for d := 0 to st.Count - 1 do
      begin
        T := LeftStr(st[d], 2);         //取字符前两个字符
        Sr := MakeFileList(T, '.tt');
        for i := 0 to sr.Count - 1 do
          Memo1.Lines.Add(Sr[i]);
      end;
    showmessage('搜索完成');
  finally
    St.Free;
    Sr.Free;
  end;
end;