≡ Menu

List the files greater than given size using powershell

Below powershell code helps you to list the files which are greater than given size(2GB in this case) and output the file sizes in MB/GB format.

PS C:local> Get-ChildItem -path c:mydata -recurse | where  { ($_.Length /1GB) -gt 2 } | foreach { ($_.length/1GB).Tostring(“0.00”) }
Do write in comments section here if you need any charification.
Happy Learning,
Sitaram Pamarthi

{ 5 comments… add one }
  • Muhammad Usman Janjua May 22, 2011, 11:15 am

    A small correction needed in the command above. The switch should be “-recurse” instead of “-recursive”. Thanks.

  • Sitaram Pamarthi May 23, 2011, 4:45 pm

    Thanks for pointing the typo. I made the correction.

  • Martin February 17, 2016, 12:48 pm

    Better solution: fileas larger than 50 MB on drive C:
    Get-ChildItem -Path C:\ -Recurse | Where-Object {$_.length/1MB -gt 50} | select fullname,@{n=”Size MB”;e={$_.length/1MB}}
    Output of this command is still object, so you cane pipe it for instance to remove-item and so on.

Leave a Comment