# Check Folder Size using PowerShell command

0
22791

Sometimes, you need to know how big a folder using PowerShell command. For the example once you on PowerShell session command and there is no GUI to check how big the folder size. Basically, you can use Get-ChildItem and Measure-Object CmdLet.

Below the one-liner PowerShell command to get the FolderSize

"{0:N2} MB" -f ((Get-ChildItem C:\users\ -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1MB)

The command above will show you the folder size in MegaBytes format with 2 decimal place in the number. If you want to get the return in GigaBytes format, you can use the following command.

"{0:N2} GB" -f ((Get-ChildItem C:\users\ -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1GB)

### Another Way !!!

You can use PSFolderSize module which you can download from PowerShell Gallery. First, you need to install the module using the following command. P.S. You may need to install the PowerShellGet first during the download.

Install-Module PSFolderSize

For the detail on how to use this command, you can run Get-Help Get-FolderSize -Detailed.

Before we continue, you need to set the execution policy to get the command runs. You can follow this link for the detail about Set ExecutionPolicy. Below is the example of the Get-FolderSize command.

PS C:\Program Files> Get-FolderSize
FolderName Size(MB) Size(GB) FullPath
---------- -------- -------- --------
WindowsApps 2,260.30 2.21 C:\Program Files\WindowsApps
Microsoft Office 1,451.87 1.42 C:\Program Files\Microsoft Office
NVIDIA Corporation 867.64 0.85 C:\Program Files\NVIDIA Corporation
Common Files 752.67 0.74 C:\Program Files\Common Files