Home > PowerShell > List the files greater than given size using powershell

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

Categories: PowerShell
  1. Muhammad Usman Janjua
    May 22, 2011 at 11:15 am | #1

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

  2. May 23, 2011 at 4:45 pm | #2

    Thanks for pointing the typo. I made the correction.

  1. July 5, 2010 at 8:07 pm | #1

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>