title: Powershell Get-ChildItem wildcard in path?
body: <p>Can a wildcard be put in a folder name mask? Or is it necessary to run <code>Get-ChildItem</code> twice, one for the direcdtories and a second for the path? Even with the code below, I'm getting no directories returned.</p>
  
  <p>I think <a href="https://stackoverflow.com/questions/18446976/get-childitem-wildcard-for-subfolder-at-any-depth-of-a-file-system-tree">this post</a> shows how to do it with the older syntax: </p>
  
  <pre class="lang-cs prettyprint-override"><code>$folderName = "c:\BizTalk\Vendors\*\AS2FilesReceived\"
  $folderMask = "$folderName\*.*" 
  $dirs = Get-ChildItem -Path $folderName -Recurse -Directory 
  Write-Host "Number of Matching Directories = $($dirs.Count)" 
  $dirs 
  
  #$files = $dirs | %{ Get-ChildItem -Path $folderMask -Filter "*.*" -Exclude "*997*.*" -File}  | Where-Object {$_.CreationTime -gt (Get-Date).AddDays(-6)} | Sort-Object LastWriteTime -Descending
  </code></pre>