title: What is the fastest\best way to get file names from a folder using PowerShell?
body: <p>The directory has 20k folders in it. In these folders there are subfolders and some files. I don't need to look into the subfolders. I need to get all the files with .EIA extension from the folders.</p>
  <p>I know I could use Get-Item, Get-ChildItem for this but these cmdlet are too slow in the getting the data. Also, this script has to run every hour therefore, it cannot be taking superlong.</p>
  <p>I was trying to use  <code>[System.IO.File]::GetFiles($path)</code> but this gives an error</p>
  <pre><code> Method invocation failed because [System.IO.File] does not contain a method named 'GetFile'
  </code></pre>
  <p>I have also tried</p>
  <pre><code>$pathEia = &quot;\\Sidney2\MfgLib\AidLibTest\*\*.EIA&quot;
   [System.IO.File]::GetFiles($pathEia)
  </code></pre>
  <p>This also throws an error:</p>
  <pre><code> Exception calling &quot;GetFiles&quot; with &quot;1&quot; argument(s): &quot;The filename, directory name, or volume label
       | syntax is incorrect. : '\\Sidney2\MfgLib\AidLibTest\*\*.EIA'&quot;
  </code></pre>
  <p>I am using
  PowerShell Core 7.2
  .Net Framework 4.8
  Any help is appreciated. Thanks in advance.</p>