PowerShell

Had to throw together a quick script to find all the large files on drive.

Ive tried to format the layout so its easy to set a min file size and change it from 10 results to to all etc

# pick location to recurse through (may bring up auth errors on C drive for windows files)
Get-ChildItem -recurse c: -File -force |
# Optional filter to only find files over a certain size (current example 1gb or more)
Where-Object {$_.Length -gt 1gb } |
# Sort objects in desc size
sort Length -descending |
# Optional filter to only list top x
select -first 10 |
# format results to show in GB, and list full path
Select-Object name, fullname, @{Name="Size GB";Expression={ "{0:N2}" -f ($_.Length / 1GB) }} , lastwritetime

 

Advertisements