{"id":3715,"date":"2014-02-21T11:57:28","date_gmt":"2014-02-21T16:57:28","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=3715"},"modified":"2014-02-21T11:57:28","modified_gmt":"2014-02-21T16:57:28","slug":"friday-fun-the-measure-of-a-folder","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/","title":{"rendered":"Friday Fun: The Measure of a Folder"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/ruler.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/ruler-150x150.png\" alt=\"ruler\" width=\"150\" height=\"150\" class=\"alignleft size-thumbnail wp-image-3686\" \/><\/a>Last week, I demonstrated how to measure a <a href=\"http:\/\/jdhitsolutions.com\/blog\/2014\/02\/friday-fun-the-measure-of-a-file\/\" title=\"Friday Fun: The Measure of a File\" target=\"_blank\">file<\/a> 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.<\/p>\n<p>Here's the complete function after which I'll point out a few key points.<\/p>\n<pre class=\"lang:ps decode:true \" >#requires -version 3.0\r\n\r\nFunction Measure-Folder {\r\n\r\n&lt;#\r\n.SYNOPSIS\r\nMeasure the size of a folder.\r\n\r\n.DESCRIPTION\r\nThis command will take a file path and create a custom measurement object that\r\nshows the number of files and the total size. The default size will be in bytes\r\nbut you can specify a different unit of measurement. The command will format the\r\nresult accordingly and dynamically change the property name as well.\r\n\r\n.PARAMETER Path\r\nThe default is the current path. The command will fail if it is not a FileSystem\r\npath.\r\n\r\n.PARAMETER Unit\r\nThe default unit of measurement is bytes, but you can use any of the standard\r\nPowerShell numeric shortcuts: \"KB\",\"MB\",\"GB\",\"TB\",\"PB\"\r\n\r\n.EXAMPLE\r\nPS C:\\&gt; measure-folder c:\\scripts \r\n\r\nPath            Name         Count         Size\r\n----            ----         -----         ----\r\nC:\\scripts      scripts       2858     43800390\r\n\r\nMeasure the scripts folder using the default size of bytes.\r\n\r\n.EXAMPLE\r\n\r\nPS C:\\&gt; dir c:\\scripts -Directory | measure-folder -Unit kb | Sort Size* -Descending | Select -first 5 | format-table -AutoSize\r\n\r\nPath                     Name          Count          SizeKB\r\n----                     ----          -----          ------\r\nC:\\scripts\\GP            GP               40  2287.080078125\r\nC:\\scripts\\Workflow      Workflow         64 1253.0185546875\r\nC:\\scripts\\modhelp       modhelp           1  386.4970703125\r\nC:\\scripts\\stuff         stuff             4       309.09375\r\nC:\\scripts\\ADTFM-Scripts ADTFM-Scripts    76  297.7880859375\r\n\r\nGet all the child folders under C:\\scripts, measuring the size in KB. Sort the\r\nresults on the size property in descending order. Then select the first 5 objects\r\nand format the results as a table.\r\n\r\n.NOTES\r\nLast Updated: 2\/21\/2014\r\nVersion     : 0.9\r\n\r\nLearn more:\r\n PowerShell in Depth: An Administrator's Guide\r\n PowerShell Deep Dives \r\n Learn PowerShell 3 in a Month of Lunches \r\n Learn PowerShell Toolmaking in a Month of Lunches \r\n\r\n  ****************************************************************\r\n  * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED *\r\n  * THOROUGHLY IN A LAB ENVIRONMENT. USE AT YOUR OWN RISK.  IF   *\r\n  * YOU DO NOT UNDERSTAND WHAT THIS SCRIPT DOES OR HOW IT WORKS, *\r\n  * DO NOT USE IT OUTSIDE OF A SECURE, TEST SETTING.             *\r\n  ****************************************************************\r\n\r\n.LINK\r\nhttp:\/\/jdhitsolutions.com\/blog\/2014\/02\/friday-fun-the-measure-of-a-folder\r\n\r\n.LINK\r\nGet-ChildItem\r\nMeasure-Object\r\n\r\n.INPUTS\r\nstring or directory\r\n\r\n.OUTPUTS\r\nCustom object\r\n#&gt;\r\n[cmdletbinding()]\r\n\r\nParam(\r\n[Parameter(Position=0,ValueFromPipeline=$True,\r\nValueFromPipelineByPropertyName=$True)]\r\n[ValidateScript({Test-Path $_})]\r\n[Alias(\"fullname\")]\r\n[string]$Path=\".\",\r\n\r\n[ValidateSet(\"Bytes\",\"KB\",\"MB\",\"GB\",\"TB\",\"PB\")]\r\n[string]$Unit=\"Bytes\"\r\n)\r\n\r\nBegin {\r\n    Write-Verbose -Message \"Starting $($MyInvocation.Mycommand)\"  \r\n} #begin\r\n\r\nProcess {\r\n    $Resolved = Resolve-Path -Path $path\r\n    $Name = Split-Path -Path $Resolved -Leaf\r\n\r\n    #verify we are in the file system\r\n    if ($Resolved.Provider.Name -eq 'FileSystem') {\r\n\r\n    #define a hash table to hold new object properties\r\n    $propHash = [ordered]@{\r\n    Path=$Resolved.Path\r\n    Name=$Name\r\n    }\r\n\r\nWrite-Verbose \"Measuring $resolved in $unit\"\r\n\r\n$stats = Get-ChildItem -Path $Resolved -Recurse -File | Measure-Object -sum length\r\n\r\nWrite-Verbose \"Measured $($stats.count) files\"\r\n\r\n$propHash.Add(\"Count\",$stats.count)\r\nSwitch ($Unit) {\r\n\r\n\"bytes\" { $propHash.Add(\"Size\",$stats.sum)       ; break }\r\n\"kb\"    { $propHash.Add(\"SizeKB\",$stats.sum\/1KB) ; break }\r\n\"mb\"    { $propHash.Add(\"SizeMB\",$stats.sum\/1MB) ; break }\r\n\"gb\"    { $propHash.Add(\"SizeGB\",$stats.sum\/1GB) ; break }\r\n\"tb\"    { $propHash.Add(\"SizeTB\",$stats.sum\/1TB) ; break }\r\n\"pb\"    { $propHash.Add(\"SizePB\",$stats.sum\/1PB) ; break }\r\n\r\n} #switch\r\n\r\n#write the new object to the pipeline\r\nNew-Object -TypeName PSobject -Property $propHash\r\n\r\n}\r\nelse {\r\n    Write-Warning \"You must specify a file system path.\"\r\n}\r\n\r\n} #process\r\n\r\nEnd {\r\n    Write-Verbose -Message \"Ending $($MyInvocation.Mycommand)\"\r\n} #end\r\n\r\n} #end function<\/pre>\n<p>The command will use the current path or you can pipe in a directory name, or the output of a Get-ChildItem expression as I show in the help examples. One thing I added is that I test the path to make sure it is a file system path because anything else wouldn't really work. <\/p>\n<pre class=\"lang:ps decode:true \" >$Resolved = Resolve-Path -Path $path\r\n$Name = Split-Path -Path $Resolved -Leaf\r\n\r\n#verify we are in the file system\r\nif ($Resolved.Provider.Name -eq 'FileSystem') {\r\n    #define a hash table to hold new object properties\r\n    $propHash = [ordered]@{\r\n    Path=$Resolved.Path\r\n    Name=$Name\r\n    }\r\n...\r\nelse {\r\n        Write-Warning \"You must specify a file system path.\"\r\n    }<\/pre>\n<p>I resolve the path so that I can get the actual name of the current location (.) and then test the provider. The other interesting feature of this function is that I format the results on the fly.<\/p>\n<p>The function has a Unit parameter which has a default value of bytes. But you can also specify one of the PowerShell numeric shortcuts like KB or GB. In the function I use a Switch construct to create a custom property on the fly.<\/p>\n<pre class=\"lang:ps decode:true \" >Switch ($Unit) {\r\n\r\n    \"bytes\" { $propHash.Add(\"Size\",$stats.sum)       ; break }\r\n    \"kb\"    { $propHash.Add(\"SizeKB\",$stats.sum\/1KB) ; break }\r\n    \"mb\"    { $propHash.Add(\"SizeMB\",$stats.sum\/1MB) ; break }\r\n    \"gb\"    { $propHash.Add(\"SizeGB\",$stats.sum\/1GB) ; break }\r\n    \"tb\"    { $propHash.Add(\"SizeTB\",$stats.sum\/1TB) ; break }\r\n    \"pb\"    { $propHash.Add(\"SizePB\",$stats.sum\/1PB) ; break }\r\n\r\n } #switch<\/pre>\n<p>Because there can only be a single value for $Unit, I'm including the Break directive so that PowerShell won't try to process any other potential matches in the Switch construct. Realistically, there's a negligible performance gain in this situation but I wanted you to see how this works.<\/p>\n<pre class=\"lang:batch decode:true \" >PS C:\\&gt; dir D:\\VM -Directory | measure-folder -Unit MB | Out-GridView -Title \"VM Size\"<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/measure-folder.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/measure-folder.png\" alt=\"measure-folder\" width=\"631\" height=\"384\" class=\"aligncenter size-full wp-image-3716\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/measure-folder.png 631w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/measure-folder-300x182.png 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/a><\/p>\n<p>I've taken some basic commands you could use interactively such as Get-ChildItem and Measure-Object and built a tool around them using a hashtable of properties to create a custom object. I hope you pick up a tip or two from this. If you have any questions about what I'm doing or why, please don't hesitate to ask because someone else might have the same question.<\/p>\n<p>Enjoy your weekend!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week, I demonstrated how to measure a file with PowerShell. This week let&#8217;s go a step further and measure a folder. I&#8217;m going to continue to use Measure-Object although this time I will need to use it to measure numeric property values. Here&#8217;s the complete function after which I&#8217;ll point out a few key&#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 Friday Fun! The Measure of a Folder with #PowerShell http:\/\/wp.me\/p1nF6U-XV","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":[271,359,8],"tags":[97,568,137,178,534,540],"class_list":["post-3715","post","type-post","status-publish","format-standard","hentry","category-friday-fun","category-powershell-3-0","category-scripting","tag-filesystem","tag-friday-fun","tag-get-childitem","tag-measure-object","tag-powershell","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Friday Fun: The Measure of a Folder &#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\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun: The Measure of a Folder &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Last week, I demonstrated how to measure a file with PowerShell. This week let&#039;s go a step further and measure a folder. I&#039;m going to continue to use Measure-Object although this time I will need to use it to measure numeric property values. Here&#039;s the complete function after which I&#039;ll point out a few key...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2014-02-21T16:57:28+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/ruler-150x150.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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun: The Measure of a Folder\",\"datePublished\":\"2014-02-21T16:57:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/\"},\"wordCount\":325,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/02\\\/ruler-150x150.png\",\"keywords\":[\"FileSystem\",\"Friday Fun\",\"Get-ChildItem\",\"Measure-Object\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"Friday Fun\",\"Powershell 3.0\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/\",\"name\":\"Friday Fun: The Measure of a Folder &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/02\\\/ruler-150x150.png\",\"datePublished\":\"2014-02-21T16:57:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/02\\\/ruler.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/02\\\/ruler.png\",\"width\":194,\"height\":159},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3715\\\/friday-fun-the-measure-of-a-folder\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Friday Fun\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/friday-fun\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun: The Measure of a Folder\"}]},{\"@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":"Friday Fun: The Measure of a Folder &#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\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun: The Measure of a Folder &#8226; The Lonely Administrator","og_description":"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 point out a few key...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/","og_site_name":"The Lonely Administrator","article_published_time":"2014-02-21T16:57:28+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/ruler-150x150.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":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun: The Measure of a Folder","datePublished":"2014-02-21T16:57:28+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/"},"wordCount":325,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/ruler-150x150.png","keywords":["FileSystem","Friday Fun","Get-ChildItem","Measure-Object","PowerShell","Scripting"],"articleSection":["Friday Fun","Powershell 3.0","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/","name":"Friday Fun: The Measure of a Folder &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/ruler-150x150.png","datePublished":"2014-02-21T16:57:28+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/ruler.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/ruler.png","width":194,"height":159},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3715\/friday-fun-the-measure-of-a-folder\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Friday Fun","item":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},{"@type":"ListItem","position":2,"name":"Friday Fun: The Measure of a Folder"}]},{"@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":4449,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4449\/measure-that-folder-with-powershell-revisited\/","url_meta":{"origin":3715,"position":0},"title":"Measure that Folder with PowerShell Revisited","author":"Jeffery Hicks","date":"July 15, 2015","format":false,"excerpt":"Last year I posted a PowerShell function to measure the size of a folder. I recently had a need to use it again, and realized it needed a few tweaks. By default, the original version recursively searched through all subfolders. But there may be situations where you only want to\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2330,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2330\/friday-fun-get-latest-powershell-scripts\/","url_meta":{"origin":3715,"position":1},"title":"Friday Fun: Get Latest PowerShell Scripts","author":"Jeffery Hicks","date":"May 18, 2012","format":false,"excerpt":"Probably like many of you I keep almost all of my scripts in a single location. I'm also usually working on multiple items at the same time. Some times I have difficult remembering the name of a script I might have been working on a few days ago that I\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/05\/get-latestscript-300x133.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4465,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4465\/measuring-folders-with-powershell-one-more-time\/","url_meta":{"origin":3715,"position":2},"title":"Measuring Folders with PowerShell One More Time","author":"Jeffery Hicks","date":"July 22, 2015","format":false,"excerpt":"I know I just posted an update to my Measure-Folder function but I couldn't help myself and now I have an update to the update. Part of the update came as the result of a comment asking about formatting results to a certain number of decimal places. I typically the\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3014,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3014\/getting-top-level-folder-report-in-powershell\/","url_meta":{"origin":3715,"position":3},"title":"Getting Top Level Folder Report in PowerShell","author":"Jeffery Hicks","date":"May 9, 2013","format":false,"excerpt":"One of the sessions I presented recently at TechDays San Francisco was on file share management with PowerShell. One of the scripts I demonstrated was for a function to get information for top level folders. This is the type of thing that could be handy to run say against the\u2026","rel":"","context":"In &quot;Conferences&quot;","block_context":{"text":"Conferences","link":"https:\/\/jdhitsolutions.com\/blog\/category\/conferences\/"},"img":{"alt_text":"foldersize","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/05\/foldersize-1024x589.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/05\/foldersize-1024x589.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/05\/foldersize-1024x589.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3685,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3685\/friday-fun-the-measure-of-a-file\/","url_meta":{"origin":3715,"position":4},"title":"Friday Fun: The Measure of a File","author":"Jeffery Hicks","date":"February 14, 2014","format":false,"excerpt":"I've been working with PowerShell since the days of Monad and have written a lot of PowerShell scripts. Out of idle curiosity, and the need for a Friday Fun topic, I decided to see how many lines of PowerShell I have written. Or at least that are in my Scripts\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":2704,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2704\/powershell-graphing-with-out-gridview\/","url_meta":{"origin":3715,"position":5},"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":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3715","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=3715"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3715\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}