title: Get total number of files and Sub folders in a folder
body: <p>I have a task to carry out 3 times a day on a WS2012R2 to get the Disk size, total number of files and folders including subdirectories from a folder on a remote server.</p>
  
  <p>Currently I get this information by RDP'ing to the target, navigating to the folder and right clicking the folder to copy the info:</p>
  
  <p><a href="https://i.stack.imgur.com/JxXFY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JxXFY.png" alt="enter image description here"></a></p>
  
  <p>I have already tried the PowerShell script :</p>
  
  <pre><code>Get-ChildItem E:\Data -Recurse -File | Measure-Object | %{$_.Count}
  </code></pre>
  
  <p>and other PowerShell scripts.</p>
  
  <p>Which produced countless errors pertaining to not having permissions for some sub directories or simply gave results I didn't want such.</p>
  
  <p>I have tried VBscript but VBscript simply cannot get this information.</p>