Title: Empty folder size value should be set to zero · Issue #14449 · PowerShell/PowerShell · GitHub
Open Graph Title: Empty folder size value should be set to zero · Issue #14449 · PowerShell/PowerShell
X Title: Empty folder size value should be set to zero · Issue #14449 · PowerShell/PowerShell
Description: Steps to reproduce We use the following instruction to calculate a folder size gci c:\my_folder | measure Length -sum However, if the folder is empty, this instruction returns an error. This happens in PowerShell 5 to PowerShell 7 (Win 1...
Open Graph Description: Steps to reproduce We use the following instruction to calculate a folder size gci c:\my_folder | measure Length -sum However, if the folder is empty, this instruction returns an error. This happen...
X Description: Steps to reproduce We use the following instruction to calculate a folder size gci c:\my_folder | measure Length -sum However, if the folder is empty, this instruction returns an error. This happen...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/14449
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Empty folder size value should be set to zero","articleBody":"## Steps to reproduce\r\n\r\nWe use the following instruction to calculate a folder size\r\n\r\ngci c:\\my_folder | measure Length -sum\r\n\r\nHowever, if the folder is empty, this instruction returns an error. This happens in PowerShell 5 to PowerShell 7 (Win 10 to Windows Server 2016 to 2019). The error message is:\r\n\r\n**Measure-Object: Cannot process argument because the value of argument “Property” is not valid. Change the value of the “Property” argument and run the operation again.**\r\n\r\n## Expected behavior\r\nReturns 0. No error. Especially, no red error message on the screen.\r\n\r\n## Actual behavior\r\nBig RED error message on the screen. Even though 0 is returned, but the error message is annoying.\r\n\r\n## Environment data\r\nc:\\my_folder is an empty folder\r\n\r\n## My opinion\r\nMeasure-Object’s behaviour is correct. So the culprit is the folder object returned by PowerShell. The size property of the folder object should be set to zero by default.\r\n\r\nOf course, if other changes in PowerShell's internal working could lead to the disappearance of the error message, I'm happy with that too.","author":{"url":"https://github.com/petrasteri","@type":"Person","name":"petrasteri"},"datePublished":"2020-12-17T07:28:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/14449/PowerShell/issues/14449"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8805734b-a9b2-bd86-cb78-624d3d072f6e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A2E:2F08F:3ED23:54695:6A558411 |
| html-safe-nonce | aa7b2d5afa578d5a24162aceeeab5a8c352d2c5671d2e9d96a5ebc7e1cae28ef |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTJFOjJGMDhGOjNFRDIzOjU0Njk1OjZBNTU4NDExIiwidmlzaXRvcl9pZCI6IjQ1OTc1MTI4ODE1Mzc2NDc2MzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6d9e9eca1403163e009f18180c483e41cc31d566290534113a46cb1cb205e1b0 |
| hovercard-subject-tag | issue:769634820 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/14449/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0aa6203515798309d2093be81cef7883ecf77d58ca382734429ebfddc060ae81/PowerShell/PowerShell/issues/14449 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0aa6203515798309d2093be81cef7883ecf77d58ca382734429ebfddc060ae81/PowerShell/PowerShell/issues/14449 |
| og:image:alt | Steps to reproduce We use the following instruction to calculate a folder size gci c:\my_folder | measure Length -sum However, if the folder is empty, this instruction returns an error. This happen... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | petrasteri |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3215163789b3dc58dba97bd78a30c20c949f477f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width