폴더 찾기 파일(폴더 파일 찾기 함수 Delphi)

2412 단어 Delphi
procedure TfrmMain.SearchPath(path, filename: string; recurse: Boolean;

  List: TStringList);   //recurse           

  procedure Traverse(APath: string);

  var

    f: TSearchRec;

    I: Integer;

  begin

    if recurse then

    begin

      if FindFirst(APath + filename,faDirectory,f) = 0 then

      repeat

        if (f.Name[1] <> '.') then

          Traverse(IncludeTrailingPathDelimiter(APath + f.Name));

      until FindNext(f) <> 0;

      FindClose(f);

    end;



    if FindFirst(APath + filename,faReadOnly or faHidden or faSysFile or faArchive, f) = 0 then

    repeat

      List.Add(APath + f.Name);

    until FindNext(f) <> 0;

    FindClose(f);

  end;

begin

  Traverse(IncludeTrailingPathDelimiter(path));

end;

좋은 웹페이지 즐겨찾기