Techibee.com

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. This command searches for files inside c:\mydata folder. You can run this against any folder.

Get-ChildItem -path c:\mydata -recurse | Where-Object  {
    ($_.Length /1GB) -gt 2 
} | ForEach-Object {
    ($_.length/1GB).Tostring("0.00")
}
Happy Learning,
Sitaram Pamarthi

 

Exit mobile version