title: How To Add TFileAttribute switch to IOUtils functions
body: <p>Shown below are two functions using <code>IOUtils</code> to count folders and files. How do you add a switch (<code>CountHidden</code>) to toggle counting files or folders with the <code>faHidden</code> <code>TFileAttribute</code>?   </p>
  
  <pre><code>function SubDirectoryCount( const Path: string; const CountHidden: boolean; const Recurse: boolean ): Cardinal;
      { Counts all the sub-directories of a specified directory. If Recurse is true
        all sub-directories are counted recursively, otherwise only immediate
        sub-directories are counted. Count Hidden toggles counting hidden files (faHidden). }
      var
        StrArray: Types.TStringDynArray; // array of subdirectories
        SearchOption: IOUtils.TSearchOption; // directory search option
      begin
        if Recurse then
          SearchOption := IOUtils.TSearchOption.soAllDirectories
        else
          SearchOption := IOUtils.TSearchOption.soTopDirectoryOnly;
        StrArray := IOUtils.TDirectory.GetDirectories( Path, '*', SearchOption );
        Result := length( StrArray );
      end;
  
      function SubDirectoryFileCount( const Path: string; const CountHidden: boolean; const Recurse: boolean ): Cardinal;
      { Counts all the files of a specified directory. If Recurse is true
        files in all sub-directories are counted recursively, otherwise only immediate
        sub-directories are counted. Count Hidden toggles counting hidden files (faHidden).}
      var
        StrArray: Types.TStringDynArray; // array of subdirectories
        SearchOption: IOUtils.TSearchOption; // directory search option
      begin
        if Recurse then
          SearchOption := IOUtils.TSearchOption.soAllDirectories
        else
          SearchOption := IOUtils.TSearchOption.soTopDirectoryOnly;
        StrArray := IOUtils.TDirectory.GetFiles( Path, '*', SearchOption );
        Result := length( StrArray );
      end;
  </code></pre>
  
  <p>Also are there any improvements that could be made to these two functions?
  I am using Delphi 2010 on Windows 7.</p>