title: How to exclude sub folders
body: <p>I want to get all "*.exe" files from one folder. It has 3 sub folders. but I want get files from 2 sub folders only. I am trying to use <code>-Exclude</code> in PowerShell. It is working to exclude single file but it is not working to exclude a folder. can anybody tell how to solve it.</p>
  
  <p>This is what I am using the below code it is working to exclude "HWEMNGR.EXE" etc files but Its not allowing me to exclude a sub folder from main folder.</p>
  
  <pre><code>$Files = Get-ChildItem -Path "D:\depot\main" -Recurse -Include "*.exe" -Exclude HWEMNGR.EXE,wmboot.exe,SDClientMobileEdition.exe | % { $_.FullName } 
  </code></pre>
  
  <p>Thanks</p>