title: In F#: How do I obtain a list of the filenames in a directory; expected unit have string
body: <p>I'm just starting with F# so I thought I would try some simple tasks.</p>
  
  <p>This lists the full paths to the xml files in a directory:</p>
  
  <pre><code>System.IO.Directory.GetFiles("c:\\tmp", "*.xml")
  |&gt; Array.iter (printfn "%s")
  </code></pre>
  
  <p>But I want only the file names so I tried:</p>
  
  <pre><code>System.IO.Directory.GetFiles("c:\\tmp", "*.xml")
  |&gt; Array.iter (System.IO.Path.GetFileName)
  |&gt; (printfn "%s")
  </code></pre>
  
  <p>This won't compile.  It gives the error:</p>
  
  <p>This expression was expected to have type
      unit<br>
  but here has type
      string  </p>
  
  <p>I searched for examples but couldn't find anything.  I'm obviously missing something simple and fundamental, but what?</p>