title: Look for strict file in strict folder directory (optimization) at Powershell
body: <p>Could you suggest better optimizzation option how to strict filesearch in specific folder</p>
  
  <p>exmp. there are smb share \10.10.10.10\%randomname%\2018\filename.xlsx</p>
  
  <p>I'm not that good at poweshell but i've been using this option, it perfectly finds <strong>filename.xlsx</strong> in any share location.</p>
  
  <pre><code>  $Files = Dir '\\10.10.10.10\' -Recurse | ? {$_.Name -eq "filename.xlsx"} | Select -ExpandProperty FullName
          $excl=New-Object -ComObject "Excel.Application"
          foreach ($file in $Files)
  ....
  </code></pre>
  
  <p>But with folder structure grow we need it to find only in most relevant folders \2018\filename.xlsx for example, and avoid recheking 2017, 2016 and wasting time.</p>
  
  <p>any thoughts on how to do smth like > <code>{$_.Name -eq "2018\filename.xlsx"}</code> :)</p>
  
  <p>Thanks.</p>