title: Count the number of folders in a directory and subdirectories
body: <p>I've got a script that will accurately tell me how many files are in a directory, and the subdirectories within. However, I'm also looking into identify how many folders there are within the same directory and its subdirectories...</p>
  
  <p>My current script:</p>
  
  <pre><code>import os, getpass
  from os.path import join, getsize
  user = 'Copy of ' + getpass.getuser()
  path = "C://Documents and Settings//" + user + "./"
  folder_counter = sum([len(folder) for r, d, folder in os.walk(path)])
  file_counter = sum([len(files) for r, d, files in os.walk(path)])
  print ' [*] ' + str(file_counter) + ' Files were found and ' + str(folder_counter) + ' folders'
  </code></pre>
  
  <p>This code gives me the print out of: <code>[*] 147 Files were found and 147 folders</code>.</p>
  
  <p>Meaning that the <code>folder_counter</code> isn't counting the right elements. How can I correct this so the <code>folder_counter</code> is correct?</p>