SID-500

Home » PowerShell » PowerShell: How to find large files using Get-Childitem

PowerShell: How to find large files using Get-Childitem

For the search, the possibilities in Windows Explorer are limited. You can search for files that are larger than 128 megabytes. That’s nice. But what if to search for files larger than 2 GB?

Run the following command to search your hard drive C: for files larger than 2 GB.

Get-Childitem -Path C:\ -File -Recurse -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt 2GB}

3.PNG

Ups. Now all know that i play Company of Heroes. 😕

And here is the more advanced version:

Get-ChildItem -Path C:\ -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

Unbenannt.JPG

Or send it to Out-GridView for a nice view.

Get-ChildItem -Path C:\ -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)}} | Out-GridView -Title "Large Files"

Unbenannt1.JPG


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

WHOIS

My name is Patrick Grünauer (pewa2303). I am from Austria. On sid-500 I write about Windows, Cisco and IT-Security in English and German. Have fun while reading!

Patrick Gruenauer
Follow SID-500 on WordPress.com