Using PowerShell To List Folders And Sizes

One of the things I run into regularly when dealing with storage is needing to know the sizes of folders in a directory.  For example, if something filled up a drive over night, and you have 50 directories on that drive, which one did it?

Thankfully, PowerShell makes it easy to list out all of the folders in a directory, and calculate the size of the contents in each folder.  Just run the below script, and change the $startDirectory path to the directory you want to check.

This nice thing about this script is that it also works on network paths (providing you have appropriate permissions).  To get the file sizes on a network share, simply change the $startDirectory path to the share you want to check.

 

(Visited 54 times, 1 visits today)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.