title: Powershell - Delete all items except those in specific subdirectories
body: <p>I have a directory containing a load of subdirectories and files. 
  I need to delete all files except those under SubFolder1.</p>
  
  <pre><code>Initial State:                       Desired Output:
  
  \                                    \
  |_Folder1                            |_Folder1
  | |_File1.txt                          |_SubFolder1
  | |_File2.xml                            |_File3.csv
  | |_SubFolder1                           |_File4.exe
  | | |_File3.csv
  | | |_File4.exe
  | |_Subfolder2
  |_Folder2
  | |_ &lt;more files here&gt;
  |_Folder3 (etc)
  </code></pre>
  
  <p>So here's what I tried:</p>
  
  <pre><code>Remove-Item * -exclude Folder1\Subfolder1\*
  </code></pre>
  
  <p>And I get a warning like this:</p>
  
  <pre><code>Confirm
  The item at C:\foo\Folder1 has children and the -recurse parameter was not specified. 
  If you continue, all children will be removed with the item. Are you sure you want to continue?
  [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
  (default is "Y"):
  </code></pre>
  
  <p>When I specify <code>-recurse</code>, it deletes every file, and seems to ignore my filters.</p>
  
  <p>What's going on, and what's the correct way of doing this?</p>
  
  <p>Edit: 
  I've included a zip file which contains an <a href="https://dl.dropbox.com/u/15385515/foo.zip">example folder structure</a> as above. If you want to test a solution, please try it against there. I've also included a second zip file which has the <a href="https://dl.dropbox.com/u/15385515/output.zip">desired output</a>, so you can check if it's working.</p>