title: Recursively count files in subfolders
body: <p>I am trying to count the files in all subfolders in a directory and display them in a list.</p>
  
  <p>For instance the following dirtree:</p>
  
  <pre><code>TEST
      /VOL01
          file.txt
          file.pic
      /VOL02
          /VOL0201
              file.nu
              /VOL020101
                  file.jpg
                  file.erp
                  file.gif
      /VOL03
          /VOL0301
              file.org
  </code></pre>
  
  <p>Should give as output:</p>
  
  <pre><code>PS&gt; DirX C:\TEST
  
  Directory              Count
  ----------------------------
  VOL01                      2
  VOL02                      0
  VOL02/VOL0201              1
  VOL02/VOL0201/VOL020101    3
  VOL03                      0
  VOL03/VOL0301              1
  </code></pre>
  
  <p>I started with the following:</p>
  
  <pre><code>Function DirX($directory)
  {
      foreach ($file in Get-ChildItem $directory -Recurse)
      {
          Write-Host $file
      }
  }
  </code></pre>
  
  <p>Now I have a question: why is my Function not recursing?</p>