Check Windows DRIVE Disk space by Folders in POWERSHELL

 Recently, my C Drive is getting almost full,  So I wants to know which folder is occupying how much space.


The easiest and fastest way is to run the command in powershell


To check how much space each folder in your C:\ drive is using, you can run this PowerShell command:


Get-ChildItem -Path C:\ -Directory | ForEach-Object {

    $size = (Get-ChildItem $_.FullName -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum

    [PSCustomObject]@{

        Folder = $_.FullName

        SizeGB = "{0:N2}" -f ($size / 1GB)

    }

} | Sort-Object SizeGB -Descending





Tips:


This might take a few minutes depending on your disk size and number of files. You can also run it for a specific folder like C:\Users or C:\Program Files by changing the -Path parameter.

Comments

Popular posts from this blog

Tavily web search using Langraph agent