title: How to use wildcards with directories in PowerShell's Get-ChildItem -Exclude cmdlet
body: <p>For a simple example, let's say I have a folder, <code>Root</code>, with three folders in it; Folder1, Folder2, and Folder3. Each of these folders (including <code>Root</code>) has a bunch of files in them, including .pdb files. I want to use the <a href="http://technet.microsoft.com/en-us/library/hh849800.aspx" rel="noreferrer">PowerShell Get-ChildItem cmdlet</a> to return all of the files in all of the folders (including <code>Root</code>), except for the .pdb files in Folder2. If I use:</p>
  
  <pre><code>Get-ChildItem -Path C:\Root -Recurse -Exclude *.pdb
  </code></pre>
  
  <p>Then I get back all of the non-.pdb files in all of the directories, which is close to what I want. So I assumed that the following would achieve what I want:</p>
  
  <pre><code>Get-ChildItem -Path C:\Root -Recurse -Exclude \*\\Folder2\\*.pdb
  </code></pre>
  
  <p>But this does not exclude any of the pdb files in Folder2 (or any other folders). I have tried several variants for the <code>-Exclude</code> filter, such as <code>Folder2\\\*.pdb</code>, but I cannot get it to work. In fact, even using <code>\*\\\*.pdb</code> does not seem to do anything; no .pdb files get excluded from any folders.</p>
  
  <p>So it seems that the wildcards cannot be used for directories, only filenames, but I assume I am just doing something wrong. I found <a href="http://technet.microsoft.com/en-us/library/ee692793.aspx" rel="noreferrer">this article explaining the wildcard and range operators</a>, but unfortunately it does not discuss using them with directory names; only file names.</p>