I need to find out how many folders and files are on shared drive. What I'd like is the same information you get when you "right click" a folder and pick Properties. There you see this information:
Size: 2.06 GB
Size on Disk: 2.06 GB
Contains: 9,705 files, 1,2,57 folders.
How do you do that with PowerShell? Now, I did find this code that works for the total folder size.
$colItems = (Get-ChildItem "C:\Program Files" -recurse | Measure-Object -property length -sum)
"{0:N2}" -f ($colItems.sum / 1MB) + " MB"
But how do I also include the total number of folders and files?