title: Script to count number of files in each directory
body: <p>I need to count the number of files on a large number of directories. Is there an easy way to do this with a shell script (using find, wc, sed, awk or similar)? Just to avoid having to write a proper script in python.</p>
  
  <p>The output would be something like this:</p>
  
  <pre><code>$ &lt;magic_command&gt;
  dir1  2
  dir2 12
  dir3  5
  </code></pre>
  
  <p>The number after the dir name would be the number of files. A plus would be able to turn counting of dot/hidden files on and off.</p>
  
  <p>Thanks!</p>