title: PowerShell - Most Compact way of "Delete all files from this folder except one"
body: <p>What is the most compact way of deleting all files from a folder <em>except</em> one file in a PowerShell script. I doesn't matter at all which file is kept, just as long as one is kept.</p>
  
  <p>I'm using the PowerShell 2 CTP.</p>
  
  <p><strong>UPDATE:</strong><br>
  An amalgamation of all the answers so far...  </p>
  
  <pre><code>$fp = "\\SomeServer\SomeShare\SomeFolder"
  gci $fp |where {$_.mode -notmatch "d"} |sort creationtime -desc |select -last ((@(gci $fp)).Length - 1) |del 
  </code></pre>
  
  <p>Anybody see any issues with using this? How about the -notmatch part?  </p>