function ListFiles(path: string): TStringList;
var
  SearchRec: TSearchRec;
  found: integer;
begin
  result := TStringList.Create;
  found := FindFirst(path + '\' + '*.*', faAnyFile, SearchRec);
  if not DirectoryExists(path) then
  begin
    Result.Clear;
    exit;
  end;
  while found = 0 do
  begin
    if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') and (SearchRec.Attr <> faDirectory) then
    begin
      if ExtractFileExt(SearchRec.Name) = '.dfm' then
        result.Add(path + '\' + SearchRec.Name);
    end
    else if (SearchRec.Attr = faDirectory) and (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
    begin
      Result.AddStrings(ListFiles(path + '\' + SearchRec.Name));
    end;
    found := FindNext(SearchRec);
  end;
  FindClose(SearchRec);
end;

http://blog.csdn.net/y281252548/article/details/51659208

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-15
  • 2021-05-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2021-10-18
  • 2021-09-01
相关资源
相似解决方案