Post

I need to find files > 2GB

Yeah, I sometimes do, here’s a simple code to do that. You can replace 2GB in Where-Object {$_.Length -gt 2GB} part to something else matching your need.

1
2
3
4
5
6
$Path = PathToBeScanned
Get-ChildItem -Path $Path -File -Recurse -ErrorAction SilentlyContinue
  | Where-Object {$_.Length -gt 2GB}
  |  Sort-Object length -Descending
  | Select-Object Name,Directory,@{n='GB';e={"{0:N2}" -F ($_.length/ 1GB)}}
  | Format-List Name,Directory,GB
This post is licensed under CC BY 4.0 by the author.