More powershell fun

A little poweshell script for finding the largest files on a drive, fire it off from the root. It’ll list the top 5 files, but can be easily changed by changing the 4 highlighted in the for loop.

$files = @();
$files = Get-ChildItem . -rec | Sort-Object Length -descending; for($i =0; $i -le 4;$i++) { echo $files[$i].Fullname; echo ("{0:N2} GB" -f ($files[$i].Length / 1GB)); }

Leave a Reply