title: How to search different file types using FindFirst?
body: <p>In my Application I use the following procedure to recursively scan any folder and subfolders, if the folder contains Text Files (*.txt) I add the filename to a TStringList defined in my procedure:</p>
  
  <pre><code>procedure FileSearch(const PathName: string; var lstFiles: TStringList);
  const
    FileMask = '*.txt';
  var
    Rec: TSearchRec;
    Path: string;
  begin
    Path := IncludeTrailingBackslash(PathName);
    if FindFirst(Path + FileMask, faAnyFile - faDirectory, Rec) = 0 then
      try
        repeat
          lstFiles.Add(Path + Rec.Name);
        until FindNext(Rec) &lt;&gt; 0;
      finally
        FindClose(Rec);
      end;
  
    if FindFirst(Path + '*.*', faDirectory, Rec) = 0 then
      try
        repeat
          if ((Rec.Attr and faDirectory) &lt;&gt; 0) and (Rec.Name &lt;&gt; '.') and
            (Rec.Name &lt;&gt; '..') then
            FileSearch(Path + Rec.Name, lstFiles);
        until FindNext(Rec) &lt;&gt; 0;
      finally
        FindClose(Rec);
      end;
  end;
  </code></pre>
  
  <p>Everything works perfect, but I want to be able to search for multiple file extensions. I have tried modifying the FileMask to do this but each time it returns nothing, likely because it is looking for an invalid extension. I have tried each of the following with no luck: (tried one at a time obviously, I did not write the below lines 3 times in my procedure)</p>
  
  <pre><code>FileMask = '*.txt|*.rtf|*.doc';
  
  FileMask = '*.txt;*.rtf;*.doc';
  
  FileMask = '*.txt,*.rtf,*.doc';
  </code></pre>
  
  <p>I feel silly for asking this, but how do I allow the extra file extensions to be included in the search? I can do it for Open and Save dialogs, why cant I separate the extensions here?</p>
  
  <p>Thanks.</p>
  
  <p>Craig.</p>