Fast & Furious PowerShell: Get Recycle Size

Here’s a fast & furious tip on using PowerShell to find out how much is in the Recycle bin. All you should need to do is use Get-ChildItem to enumerate the Recycle folder. By default it is hidden so you need to use the -Force parameter. To get the total size of all the files, simply run this:

PS E:\ > Get-ChildItem c:\recycler -force -recurse | measure length -sum

Count : 42
Average :
Sum : 72133693
Maximum :
Minimum :
Property : length

I can see there are 42 files taking up 72133693 bytes of space. I can also use this to check remote systems as well:

Get-ChildItem \dc01\c$\recycler -force -recurse | measure length -sum

If you want a cleaner one liner, try this:

“{0:N2}” -f ((Get-ChildItem e:\recycler -force -recurse | measure length -sum ).sum/1mb)

This will display the sum, formatted to two decimal points in MB.

del.icio.us tags: , , , ,