title: Directory sizes and extensions
body: <p>I'd like to create python command line code that is able to print directory tree with sizes of all subdirectories (from certain directory) and most frequent extensions... I will show the example output.</p>
  <blockquote>
  <ul>
  <li>root_dir (5 GB, jpg (65 %): avi ( 30 %) : pdf (5 %))</li>
  </ul>
  <p>-- aa (3 GB, jpg (100 %) )</p>
  <p>-- bb (2 GB, avi (20 %) : pdf (2 %) )</p>
  <p>--- bbb (1 GB, ...)</p>
  <p>--- bb2 (1 GB, ...)</p>
  <p>-- cc (1 GB, pdf (100 %) )</p>
  </blockquote>
  <p>The format is :</p>
  <p>nesting level, directory name (size of the directory with all files and subdirectories, most frequent extensions with size percentages in this directory.</p>
  <p>I have <a href="http://pastebin.com/8PAc9EpR" rel="nofollow noreferrer">this</a> code snippet so far. The problem is that it counts only file sizes in directory, so the resulting size is smaller than real size of the directory. Other problem is how to put it all together to print the tree I defined above without redundant computations.</p>