I wanted to take out a very simple report on the largest sub folders in terms of size, for a profile area on a client site
. We have tools to do this, but scripting it was in this case a very quick and dirty way to get the job done
.
This script is reusable on all folders
. It will enumerate the size of the content of all sub folders on the folder on which you run it, measured in megabytes
limitation during cialis generic the time) Sometimes.
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<# Reidar J. Boldevin - 29.10.2014 The Tech Depot http://www.boldevin.com Please leave this header in place #> $report = @{} $folders = Get-ChildItem -Directory foreach ($folder in $folders) { $size = Get-ChildItem $folder -Recurse | Measure-Object -property length -sum $size = ($size.sum / 1MB) #Use 1KB for kilobytes, 1MB for megabytes, 1GB for gigabytes or 1TB for terabytes $report.Add($folder,$size) } $report.GetEnumerator() | Sort-Object value -Descending |