{"id":7317,"date":"2020-02-25T09:39:14","date_gmt":"2020-02-25T14:39:14","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=7317"},"modified":"2020-02-25T09:39:14","modified_gmt":"2020-02-25T14:39:14","slug":"fast-folder-sizes-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/","title":{"rendered":"Fast Folder Sizes with PowerShell"},"content":{"rendered":"<p>I am always looking for ways to do things faster and easier with PowerShell. One common task that I never seem to stop needing is discovering how much disk space a given folder is consuming. Even though disk space is cheap these days, I guess I'm old-school enough to want to keep things lean.<\/p>\n<p>It is simple enough to run Get-Childitem and pipe the results to Measure-Object.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7318\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize.png\" alt=\"get folder size with PowerShell\" width=\"1902\" height=\"224\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize.png 1902w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize-300x35.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize-1024x121.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize-768x90.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize-1536x181.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize-850x100.png 850w\" sizes=\"auto, (max-width: 1902px) 100vw, 1902px\" \/><\/p>\n<p>But this can be often time consuming. The other drawbacks, besides typing is it takes extra work for format the results into something more user friendly. And if i want to include hidden files, I have to remember to use -Force with Get-ChildItem.<\/p>\n<p>Cmdlets are nice and convenient. And I always recommend to beginner or even intermediate scripters, if there is a cmdlet to use over the .NET Framework, use the cmdlet. But there are always exceptions and as you grow in expertise, you'll realize there are times when going directly to the .NET Framework is a better choice. Which is what I have done.<\/p>\n<p>In the latest version of the PSScriptTools module, I created a new function called <a href=\"https:\/\/github.com\/jdhitsolutions\/PSScriptTools\/blob\/master\/docs\/Get-FolderSizeInfo.md\" target=\"_blank\" rel=\"noopener noreferrer\">Get-FolderSizeInfo<\/a>. I still have the ease of running a command at a PowerShell prompt, but the function uses the .NET Framework to speed up enumerating and measuring files. You can view the source code <a href=\"https:\/\/github.com\/jdhitsolutions\/PSScriptTools\/blob\/master\/functions\/Get-FolderSizeInfo.ps1\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> if you are interested.<\/p>\n<p>Now I can easily and quickly get the size of \u00a0folder. The default is to skip hidden files and foldes, but I can easily include them as well.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7319\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/get-foldersize1.png\" alt=\"get-foldersize1\" width=\"1602\" height=\"496\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/get-foldersize1.png 1602w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/get-foldersize1-300x93.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/get-foldersize1-1024x317.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/get-foldersize1-768x238.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/get-foldersize1-1536x476.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/get-foldersize1-850x263.png 850w\" sizes=\"auto, (max-width: 1602px) 100vw, 1602px\" \/><\/p>\n<p>This also makes it easy to check top level folders.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7320\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-from-2020-02-25-09-26-28.png\" alt=\"Screenshot from 2020-02-25 09-26-28\" width=\"2052\" height=\"1066\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-from-2020-02-25-09-26-28.png 2052w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-from-2020-02-25-09-26-28-300x156.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-from-2020-02-25-09-26-28-1024x532.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-from-2020-02-25-09-26-28-768x399.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-from-2020-02-25-09-26-28-1536x798.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-from-2020-02-25-09-26-28-2048x1064.png 2048w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/Screenshot-from-2020-02-25-09-26-28-850x442.png 850w\" sizes=\"auto, (max-width: 2052px) 100vw, 2052px\" \/><\/p>\n<p>And because the function is writing a custom object to the pipeline with a unique typename, I added a custom format ps1xml file that allows me to format results as KB, MB or GB.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7321\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize2.png\" alt=\"getfoldersize2\" width=\"1960\" height=\"544\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize2.png 1960w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize2-300x83.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize2-1024x284.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize2-768x213.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize2-1536x426.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize2-850x236.png 850w\" sizes=\"auto, (max-width: 1960px) 100vw, 1960px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7322\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3.png\" alt=\"getfoldersize3\" width=\"1928\" height=\"554\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3.png 1928w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3-300x86.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3-1024x294.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3-768x221.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3-1536x441.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/getfoldersize3-850x244.png 850w\" sizes=\"auto, (max-width: 1928px) 100vw, 1928px\" \/><\/p>\n<p>As you can see from my screenshots, this command works cross platform on PowerShell 7.<\/p>\n<p>If you are interested in this, you can <a href=\"https:\/\/github.com\/jdhitsolutions\/PSScriptTools\/blob\/master\/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">learn more<\/a> about the PSScriptTools module or install it from the PowerShell Gallery. I hope you find this as useful as I do.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am always looking for ways to do things faster and easier with PowerShell. One common task that I never seem to stop needing is discovering how much disk space a given folder is consuming. Even though disk space is cheap these days, I guess I&#8217;m old-school enough to want to keep things lean. It&#8230;<\/p>\n","protected":false},"author":1,"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,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New on the blog: Fast Folder Sizes with #PowerShell","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[137,178,534,623,540],"class_list":["post-7317","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-get-childitem","tag-measure-object","tag-powershell","tag-psscripttools","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Fast Folder Sizes with PowerShell &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fast Folder Sizes with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I am always looking for ways to do things faster and easier with PowerShell. One common task that I never seem to stop needing is discovering how much disk space a given folder is consuming. Even though disk space is cheap these days, I guess I&#039;m old-school enough to want to keep things lean. It...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-25T14:39:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Fast Folder Sizes with PowerShell\",\"datePublished\":\"2020-02-25T14:39:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/\"},\"wordCount\":350,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/psfoldersize.png\",\"keywords\":[\"Get-ChildItem\",\"Measure-Object\",\"PowerShell\",\"PSScriptTools\",\"Scripting\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/\",\"name\":\"Fast Folder Sizes with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/psfoldersize.png\",\"datePublished\":\"2020-02-25T14:39:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/psfoldersize.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/psfoldersize.png\",\"width\":1902,\"height\":224,\"caption\":\"get folder size with PowerShell\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7317\\\/fast-folder-sizes-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Fast Folder Sizes with PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Fast Folder Sizes with PowerShell &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Fast Folder Sizes with PowerShell &#8226; The Lonely Administrator","og_description":"I am always looking for ways to do things faster and easier with PowerShell. One common task that I never seem to stop needing is discovering how much disk space a given folder is consuming. Even though disk space is cheap these days, I guess I'm old-school enough to want to keep things lean. It...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2020-02-25T14:39:14+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Fast Folder Sizes with PowerShell","datePublished":"2020-02-25T14:39:14+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/"},"wordCount":350,"commentCount":5,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize.png","keywords":["Get-ChildItem","Measure-Object","PowerShell","PSScriptTools","Scripting"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/","name":"Fast Folder Sizes with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize.png","datePublished":"2020-02-25T14:39:14+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/02\/psfoldersize.png","width":1902,"height":224,"caption":"get folder size with PowerShell"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7317\/fast-folder-sizes-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Fast Folder Sizes with PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":9057,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9057\/using-powershell-your-way\/","url_meta":{"origin":7317,"position":0},"title":"Using PowerShell Your Way","author":"Jeffery Hicks","date":"June 6, 2022","format":false,"excerpt":"I've often told people that I spend my day in a PowerShell prompt. I run almost my entire day with PowerShell. I've shared many of the tools I use daily on Github. Today, I want to share another way I have PowerShell work the way I need it, with minimal\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/06\/dl.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/06\/dl.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/06\/dl.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/06\/dl.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":8622,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8622\/finding-modified-files-with-powershell\/","url_meta":{"origin":7317,"position":1},"title":"Finding Modified Files with PowerShell","author":"Jeffery Hicks","date":"October 14, 2021","format":false,"excerpt":"Here's another task that I seem to be constantly fiddling with using PowerShell. What files did I work on yesterday? Or what files were modified in the last 48 hours? Obviously, Get-ChildItem is going to be the primary command. It is simple enough to get files based on an extension\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/extension-report.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/extension-report.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/extension-report.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":7549,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7549\/building-a-powershell-inventory\/","url_meta":{"origin":7317,"position":2},"title":"Building a PowerShell Inventory","author":"Jeffery Hicks","date":"June 16, 2020","format":false,"excerpt":"A few weeks ago, a new Iron Scripter PowerShell scripting challenge was issued. For this challenge we were asked to write some PowerShell code that we could use to inventory our PowerShell script library.\u00a0 Here's how I approached the problem, which by no means is the only way. Lines of\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/ast-results.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/ast-results.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/06\/ast-results.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2704,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2704\/powershell-graphing-with-out-gridview\/","url_meta":{"origin":7317,"position":3},"title":"PowerShell Graphing with Out-Gridview","author":"Jeffery Hicks","date":"January 14, 2013","format":false,"excerpt":"I've received a lot of interest for my last few posts on graphing with the PowerShell console. But I decided I could add one more feature. Technically it might have made more sense to turn this into a separate function, but I decided to simply modify the last version of\u2026","rel":"","context":"In &quot;Powershell 3.0&quot;","block_context":{"text":"Powershell 3.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-3-0\/"},"img":{"alt_text":"out-consolegraph-gv","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-gv-1024x548.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-gv-1024x548.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-gv-1024x548.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3715,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/","url_meta":{"origin":7317,"position":4},"title":"Friday Fun: The Measure of a Folder","author":"Jeffery Hicks","date":"February 21, 2014","format":false,"excerpt":"Last week, I demonstrated how to measure a file with PowerShell. This week let's go a step further and measure a folder. I'm going to continue to use Measure-Object although this time I will need to use it to measure numeric property values. Here's the complete function after which I'll\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"ruler","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/ruler-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1546,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/1546\/get-top-level-folder-usage\/","url_meta":{"origin":7317,"position":5},"title":"Get Top Level Folder Usage","author":"Jeffery Hicks","date":"July 4, 2011","format":false,"excerpt":"This is too long to tweet, even written as a one liner. But this will search a folder for top level subfolders and return the file usage for each. [cc lang=\"PowerShell\"] $folder=\"S:\\\" dir $folder | where {$_.psIscontainer} | foreach { $stat= dir $_.fullname -recurse | Measure-Object -property length -Sum New-Object\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7317"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7317\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}