Skip to content

Instantly share code, notes, and snippets.

@skurscheid
Created April 6, 2020 04:36
Show Gist options
  • Save skurscheid/2b615647bbb65ec4a2d178e913aa51f6 to your computer and use it in GitHub Desktop.
Save skurscheid/2b615647bbb65ec4a2d178e913aa51f6 to your computer and use it in GitHub Desktop.
Windows PowerShell: list subdirectories including size on disk in GB
gci -force 'C:\Users'-ErrorAction SilentlyContinue | ? { $_ -is [io.directoryinfo] } | % {
$len = 0
gci -recurse -force $_.fullname -ErrorAction SilentlyContinue | % { $len += $_.length }
$_.fullname, '{0:N2} GB' -f ($len / 1Gb)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment