
Get-ChildItem outputs a list of items in the current location (in files and folders, if your current location is in a file system), and Measure-Object uses this list as input and adds together every input object’s Length property (file size). Get-ChildItem | Measure-Object -Sum Length A simple example would be a command like this: In this case, I know that Windows PowerShell can find files ( Get-ChildItem), and I know that it can count objects and sum a property on objects. The trick is learning how to combine the tools to get the results you need.

If you have worked with Windows PowerShell for any length of time, you know that it provides a pretty comprehensive set of tools. For example, what if you need the size for 100 different folders? As with all things GUI, this does not scale well. You have probably asked this question hundreds of times, “How big is that folder?” Of course, the typical GUI way to find out is to right-click the folder in Windows Explorer and open the folder’s properties. Bill Stewart is a scripting guru and a moderator for the Official Scripting Guys forum.

Microsoft Scripting Guy, Ed Wilson, is here. Summary: Guest blogger, Bill Stewart, discusses a Windows PowerShell function to determine folder size.
