title: Find the first file that matches a pattern using PowerShell
body: <p>I would like to select any one ".xls" file in a directory. The problem is the <a href="http://technet.microsoft.com/en-us/library/hh849800.aspx" rel="noreferrer">dir</a> command can return different types.</p>
  
  <pre><code>gci *.xls
  </code></pre>
  
  <p>will return</p>
  
  <ul>
  <li>object[] if there is more than one file</li>
  <li>FileInfo if there is exactly one file</li>
  <li>null if there are no files</li>
  </ul>
  
  <p>I can deal with null, but how do I just select the "first" file?</p>