{"id":83,"date":"2007-03-01T12:00:00","date_gmt":"2007-03-01T20:00:00","guid":{"rendered":"http:\/\/testblog.sapien.com\/index.php\/2007\/03\/01\/fast-furious-powershell-get-recycle-size\/"},"modified":"2007-03-01T12:00:00","modified_gmt":"2007-03-01T20:00:00","slug":"fast-furious-powershell-get-recycle-size","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2007\/03\/01\/fast-furious-powershell-get-recycle-size\/","title":{"rendered":"Fast &#038; Furious PowerShell: Get Recycle Size"},"content":{"rendered":"<p>Here&#8217;s a fast &amp; 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:<\/p>\n<p><font size=\"2\" face=\"Lucida Console\" color=\"#0000ff\" style=\"color: rgb(0, 0, 255);\">PS E:\\ &gt; Get-ChildItem c:\\recycler -force -recurse | measure length -sum <\/font><\/p>\n<p><font size=\"2\" face=\"Lucida Console\" color=\"#0000ff\" style=\"color: rgb(0, 0, 255);\">Count : 42<br \/>Average :<br \/>Sum : 72133693<br \/>Maximum :<br \/>Minimum :<br \/>Property : length<\/font> <\/p>\n<p>I can see there are 42 files taking up 72133693 bytes of space. I can also use this to check remote systems as well:<\/p>\n<p><font size=\"2\" face=\"Lucida Console\" color=\"#0000ff\" style=\"color: rgb(0, 0, 255);\">Get-ChildItem &#92;dc01\\c$\\recycler -force -recurse | measure length -sum<\/font><\/p>\n<p>If you want a cleaner one liner, try this:<\/p>\n<p><font size=\"2\" face=\"Lucida Console\" color=\"#0000ff\" style=\"color: rgb(0, 0, 255);\">&#8220;{0:N2}&#8221; -f ((Get-ChildItem e:\\recycler -force -recurse | measure length -sum ).sum\/1mb)<\/font><\/p>\n<p>This will display the sum, formatted to two decimal points in MB.<\/p>\n<div class=\"wlWriterSmartContent\" id=\"0767317B-992E-4b12-91E0-4F059A8CECA8:e1e7d801-49be-4824-a16a-446c50878aba\" style=\"margin: 0px; padding: 0px; display: inline;\">Technorati tags: <a href=\"http:\/\/technorati.com\/tags\/PowerShell\" rel=\"tag\">PowerShell<\/a>, <a href=\"http:\/\/technorati.com\/tags\/Get-ChildItem\" rel=\"tag\">Get-ChildItem<\/a>, <a href=\"http:\/\/technorati.com\/tags\/Format\" rel=\"tag\">Format<\/a>, <a href=\"http:\/\/technorati.com\/tags\/Measure\" rel=\"tag\">Measure<\/a>, <a href=\"http:\/\/technorati.com\/tags\/Sum\" rel=\"tag\">Sum<\/a><\/div>\n<p> <\/p>\n<div class=\"wlWriterSmartContent\" id=\"0767317B-992E-4b12-91E0-4F059A8CECA8:9d8070fc-4b57-485a-945c-2c67873f4e87\" style=\"margin: 0px; padding: 0px; display: inline;\">del.icio.us tags: <a href=\"http:\/\/del.icio.us\/popular\/PowerShell\" rel=\"tag\">PowerShell<\/a>, <a href=\"http:\/\/del.icio.us\/popular\/Get-ChildItem\" rel=\"tag\">Get-ChildItem<\/a>, <a href=\"http:\/\/del.icio.us\/popular\/Format\" rel=\"tag\">Format<\/a>, <a href=\"http:\/\/del.icio.us\/popular\/Measure\" rel=\"tag\">Measure<\/a>, <a href=\"http:\/\/del.icio.us\/popular\/Sum\" rel=\"tag\">Sum<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a fast &#038; 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&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[25],"tags":[],"class_list":["post-83","post","type-post","status-publish","format-standard","hentry","category-windows-powershell"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=83"}],"version-history":[{"count":0,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/83\/revisions"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}