How to find file in Delphi

It's very simple. Just drop TFileSearch component onto your form, set the search parameters (root search path, file mask, etc.) and call Search. The OnFound event will be fired for each found file/folder. When search process is finished the OnFinished event is fired. Recursive subfolder search is supported.

procedure TfrmFSearchMain.cmpFileSearchFound(Sender: TObject; FileInfo: TFileInfo;
  var Abort: Boolean);
begin
  with FileInfo,lsvResults.Items.Add do
  begin
    if Directory then ImageIndex:=0
    else ImageIndex:=1;
    Caption:=Path+Name;
    Subitems.Text:=
      DateTimeToStr(CreationTime)+#13+
      DateTimeToStr(LastAccessTime)+#13+
      DateTimeToStr(LastWriteTime)+#13+
      IntToStr(FileSize)+#13+
      AttributesText;
  end;
  with Sender as TFileSearch do
  begin
    lblFolders.Caption:=IntToStr(FolderCount);
    lblFiles.Caption:=IntToStr(FileCount);
  end;
  Application.ProcessMessages;
end;

Passed FileInfo parameter contains all the information about file/folder.

TFileInfo = record
  Directory: Boolean;
  Attributes: TAttributes;
  AttributesText: WideString;
  CreationTime,LastAccessTime,LastWriteTime: TDateTime;
  FileSize: Integer;
  Path,Name,ShortName: WideString;
end;
See also
File Search
Components for Delphi / C++ Builder
Howtos for Programmers