PowerTip: Determine Size of Folder with PowerShell


Summary: Use Windows PowerShell to determine the size of a folder.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily get the size of a folder structure?

Hey, Scripting Guy! Answer Use a combination of Get-Childitem and Measure-Object. For example, to see the size of the C:\Foo folder
           structure in Windows PowerShell 5.0 or 4.0, use:

Get-Childitem C:\Foo –file –recurse | Measure-Object –property Length -sum

Comments (4)

  1. Harneet Kaur says:

    A question has been asked from https://adeptcareer.in visitor about PowerShell version.
    Which version is best to use for beginners?

  2. Amir Khusainov says:

    I think that beginners should start with last version and this book from Don Jones Learn PowerShell 3 in a Month of Lunches. This is really great book for beginners. More on morelunches.com.

  3. @Harneet Kaur

    From personal experience and coming from a Non Dev background with no time for training, I can say it won’t matter as the skills transfer easily from version to version. But learning in TOO old of a version has you working harder than you need.

    As the previous poster mentioned the series from Don Jones gets you a great start, there’s also the Step-By-Step from Ed Wilson. As for a starting version I would say no less than version 3. This gets you a better ISE and maybe not TOO many Cmdlets.

    The main thing is the Syntax does not change. What you learn in HOW to write a Script, or Get Help, or interact with the Console, does not go away in newer versions. The Usability just improves and things just get easier down the road 🙂

    Cheers!
    Sean
    Honorary Scripting Guy

Skip to main content