Short posts about Microsoft PowerShell as I learn, trying to focus on one aspect at a time.
Tuesday, June 30, 2009
Recursively Getting All Folder Sizes
This started out as my entry for Event 8 in the Microsoft Scripting Games 2009 (see more entries here), but it's useful, so I think I'll keep it. This function uses recursion to work its way down the directory tree and get all folders and their sizes, and outputs them as psobjects for easy sorting, etc. It's not the fastest thing in the world, but it does the trick. Make sure to check out the examples in the help documentation.