title: Batch Count Files And Subfolders in a directory
body: <p>I have 100 folders with subfolders inside them
  i want to count how many subfolders i have in each folder and how many files.
  then i want all to be in a txt file with the name of the folder the number of subfolder in each one and number of files in each one.
  i would also like to have a title on the top of each column .
  so it will look like this:
  <a href="https://i.stack.imgur.com/bNp1J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bNp1J.png" alt="enter image description here"></a>
  Now im using this code which almost work </p>
  
  <pre><code>@echo off
  FOR /D %%G in ("*") DO (
     PUSHD "%%G"
     FOR /F "delims=" %%H in ('dir /a-d /b * ^|find /C /V ""')  DO echo %%G %%H&gt;&gt;"..\count.txt" Files
     FOR /F "delims=" %%I in ('dir /a:d /b * ^|find /C /V ""')  DO echo %%G %%I&gt;&gt;"..\count.txt" Folders
   POPD )
  </code></pre>
  
  <p>it gives me the correct sub folders 
  and also the correct files in a folder.
  i dont know how ro make the titles on top and also how to get the files count and folder count next to each other.
  in my code they are one under the other</p>
  
  <p>Add on to the question , you guys found the solution for the first part , now id like to add info on another sub folder but i dont want 2 scripts to do that , i want all display in the txt file. so it will look something like this:<a href="https://i.stack.imgur.com/FLwOz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FLwOz.png" alt="Second Part"></a></p>