Summarizing folder and sub-folder content

I recently encountered a familiar issue during copying data from one server to another - in that somewhere, located in some deep sub-folder was thousands of small files. This meant that compressing/copying the data was taking quite a long time. Now why would I wait for an hour to copy some files if I could spend two hours writing a program to find the folder creating my issues? Because I'm a developer - that's why. And why would I write something from scratch when there's probably a bunch of tools for this available already? Because it's fun - that's why.

Anyways - I am posting the Powershell script here for people who do not have time to re-invent the wheel, or do not enjoy doing so.


To summarize the current folder, from Powershell:


To summarize a specified folder:

.\FileTree.ps1 C:\Data\SomeFolder
The Script