Large File Sizes

Published: 2024-03-31

#change the number after the "-gt" to filter the size files you want
#100000000 = 100MB
#1000000000 = 1GB
#change the "c:\users\yourname" after "-path" to select which path to run on
#can run on "c:" if needed

Get-ChildItem -path c:\users\yourname -ErrorAction silentlycontinue -Recurse | 
Where-Object {($_.Length) -gt '1000000000'} |
Sort-Object -Property length -Descending | 
Format-Table -autosize -wrap -property `
    @{Label=Last access;Expression={($_.lastwritetime).ToshortDateString()}}, 
    @{label=size in megabytes;Expression={{0:N2} -f ($_.Length / 1MB)}},
    fullname