Title: Get-ChildItem -Recurse shouldn't quietly ignore -Include and -Exclude when -LiteralPath is used instead of -Path · Issue #3730 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-ChildItem -Recurse shouldn't quietly ignore -Include and -Exclude when -LiteralPath is used instead of -Path · Issue #3730 · PowerShell/PowerShell
X Title: Get-ChildItem -Recurse shouldn't quietly ignore -Include and -Exclude when -LiteralPath is used instead of -Path · Issue #3730 · PowerShell/PowerShell
Description: Even without using wildcards, Get-ChildItem -Recurse allows matching items on every level of the target hierarchy, possibly filtered with -Include and -Exclude. However, if you use -LiteralPath rather than the (implied) -Path parameter, ...
Open Graph Description: Even without using wildcards, Get-ChildItem -Recurse allows matching items on every level of the target hierarchy, possibly filtered with -Include and -Exclude. However, if you use -LiteralPath rat...
X Description: Even without using wildcards, Get-ChildItem -Recurse allows matching items on every level of the target hierarchy, possibly filtered with -Include and -Exclude. However, if you use -LiteralPath rat...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3730
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-ChildItem -Recurse shouldn't quietly ignore -Include and -Exclude when -LiteralPath is used instead of -Path","articleBody":"Even without using wildcards, `Get-ChildItem -Recurse` allows matching items on every level of the target hierarchy, possibly filtered with `-Include` and `-Exclude`.\r\n\r\nHowever, if you use `-LiteralPath` rather than the (implied) `-Path` parameter, `-Include` and `-Exclude` are _quietly ignored_:\r\n\r\n_If_ there's a good reason for this behavior (none that I'm aware of), then at the very least a _warning_ about `-Include` / `-Exclude` getting ignored should be issued, or a separate parameter set should prevent combining `-LiteralPath` with `-Include` / `-Exclude`.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\nGet-ChildItem $PSHOME -Recurse -Exclude * # implies -Path $PSHOME\r\nGet-ChildItem -LiteralPath $PSHOME -Recurse -Exclude *\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nBoth calls should yield _no_ output, because all items should be excluded by virtue of `-Exclude *`.\r\n\r\nActual behavior\r\n---------------\r\n\r\nThe 2nd command, due to `-Exclude *` getting _ignored_, outputs the entire subtree of `$PSHOME`.\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable --\u003e\r\n\r\n```powershell\r\nPowerShell Core v6.0.0-alpha (v6.0.0-alpha.18) on macOS 10.12.4\r\nPowerShell Core v6.0.0-alpha (v6.0.0-alpha.18) on Microsoft Windows 10 Pro (64-bit; v10.0.14393)\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2017-05-08T01:33:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/3730/PowerShell/issues/3730"}
| 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:dbfd16af-2d27-e5ba-817b-aad14d5e7532 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C2B0:30AEBB:1F2673:2A6EEE:6A553795 |
| html-safe-nonce | faeadae3d19e2c3ab8fc91cc2163867a80c08aff2d428f5d1682760a645c27b4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkIwOjMwQUVCQjoxRjI2NzM6MkE2RUVFOjZBNTUzNzk1IiwidmlzaXRvcl9pZCI6IjU4MTcxOTEyOTkwNDk0MDQzMDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0900c3edfdb7bb2b057976bed62ba353bf6cb062d5d6e086198d2c22e293e45d |
| hovercard-subject-tag | issue:226914742 |
| 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/3730/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7573834468b25de5cf711f6edc9207f32bb26aee162f02d5281acc9c914a7342/PowerShell/PowerShell/issues/3730 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7573834468b25de5cf711f6edc9207f32bb26aee162f02d5281acc9c914a7342/PowerShell/PowerShell/issues/3730 |
| og:image:alt | Even without using wildcards, Get-ChildItem -Recurse allows matching items on every level of the target hierarchy, possibly filtered with -Include and -Exclude. However, if you use -LiteralPath rat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | fbd8fce4d63ac394c5405faa20aa50d5c9e56b979ac43ee1b26f8e7c47c4cd89 |
| 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 | 811f50b757204c6a1b4da0ea780075b3e1cc9e57 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width