How to find out which folder takes up the most space?
Symptom
HDD drive of the windows server had utilised more that 80%
How do we determine which folder is using the most space?
Environment
10.0;10.1;10.2;10.3;10.4;10.5;10.6;10.7;10.8;10.9;10.10;11.1;11
HDD utilisation is high.
Cause
HDD utilisation is high.
Resolution
Using this PS script:
--
$targetfolder='C:\'
$dataColl = @()
gci -force $targetfolder -ErrorAction SilentlyContinue | ? { $_ -is [io.directoryinfo] } | % {
$len = 0
gci -recurse -force $_.fullname -ErrorAction SilentlyContinue | % { $len += $_.length }
$foldername = $_.fullname
$foldersize= '{0:N2}' -f ($len / 1Gb)
$dataObject = New-Object PSObject
Add-Member -inputObject $dataObject -memberType NoteProperty -name foldername -value $foldername
Add-Member -inputObject $dataObject -memberType NoteProperty -name foldersizeGb -value $foldersize
$dataColl += $dataObject
}
$dataColl | Out-GridView -Title “Size of subdirectories”
--
Save the above script as a ps1. And execute it in powershell as administrator
This script will generate a grid view of the child folders under the drive/folder that is specified as target.
From here you can know which folder is taking up the most space, then update the target folder in the script to it and find out more about this folder.