Title: Remove-Item and Move-Item don't support escape characters in wildcard patterns on Unix · Issue #3725 · PowerShell/PowerShell · GitHub
Open Graph Title: Remove-Item and Move-Item don't support escape characters in wildcard patterns on Unix · Issue #3725 · PowerShell/PowerShell
X Title: Remove-Item and Move-Item don't support escape characters in wildcard patterns on Unix · Issue #3725 · PowerShell/PowerShell
Description: Note: Applies to Linux and macOS, but not to Windows Possibly related: #3724 Wildcard patterns- at least in the context of Get-Item - support ` as the escape character to represent literal ` instances in a path and to escape the followin...
Open Graph Description: Note: Applies to Linux and macOS, but not to Windows Possibly related: #3724 Wildcard patterns- at least in the context of Get-Item - support ` as the escape character to represent literal ` instan...
X Description: Note: Applies to Linux and macOS, but not to Windows Possibly related: #3724 Wildcard patterns- at least in the context of Get-Item - support ` as the escape character to represent literal ` instan...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3725
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remove-Item and Move-Item don't support escape characters in wildcard patterns on Unix","articleBody":"Note: \r\n* Applies to Linux and macOS, but not to Windows\r\n* Possibly related: #3724\r\n\r\nWildcard patterns- at least in the context of `Get-Item` - support `` ` `` as the escape character to represent literal `` ` `` instances in a path and to escape the following metacharacters: `* ? [ ]`\r\n\r\n`Remove-Item` and `Move-Item` currently do not support that, neither with `-Path` nor with `-Include`.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\n# Create a file that contains a literal backtick and a literal substring that would be a valid\r\n# sub-pattern if interpreted as a wildcard expression.\r\nNew-Item -Type File 'a`[b]'\r\n\r\n# Match the newly created file using a wildcard expression with suitable escaping.\r\nRemove-Item * -Include 'a```[b`]' -WhatIf\r\nRemove-Item -Path 'a```[b`]' -WhatIf\r\n\r\nMove-Item * -Include 'a```[b`]' /tmp -WhatIf\r\nMove-Item -Path 'a```[b`]' /tmp -WhatIf\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nBoth commands in each pair should find the target file and output information about how it _would_ be deleted / moved.\r\n\r\nActual behavior\r\n---------------\r\n\r\nAll commands unexpectedly fail to find the file:\r\n\r\n```\r\nRemove-Item : An object at the specified path /Users/jdoe/a`[b] does not exist.\r\n...\r\n```\r\nCuriously, the error message quotes the correct _literal_ path that it claims doesn't exist.\r\n\r\n`Move-Item`'s symptoms differ: \r\n\r\n```\r\nMove-Item : Cannot move item because the item at '...' does not exist.\r\n...\r\nMove-Item : The specified wildcard character pattern is not valid: a\\[b\r\n```\r\n\r\nCuriously, all existing files in the directory (even those that don't match the pattern) are reported as non-existent.\r\n\r\nEnvironment data\r\n----------------\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 Ubuntu 16.04\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2017-05-07T19:52:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/3725/PowerShell/issues/3725"}
| 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:7a4eec18-165f-e5b3-e473-55dba294396c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B6A2:107B61:2D5673:3F5CA2:6A59C75A |
| html-safe-nonce | 9d64a7f9c9cdc7dd077c469d9a4240a7a627c9407bf70cfe9441685433439e50 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkEyOjEwN0I2MToyRDU2NzM6M0Y1Q0EyOjZBNTlDNzVBIiwidmlzaXRvcl9pZCI6IjgwMDAxMjgwNzI0MjIxMTUxNjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 37eaf0cc4afe734af3cbb02b84ab187efeb6cf7956466446b19cc5625b3fbcdc |
| hovercard-subject-tag | issue:226888529 |
| 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/3725/issue_layout |
| twitter:image | https://opengraph.githubassets.com/275c80be188641417284c5304a10f1e446ade64459a8a33dc5bf4947fc8f9707/PowerShell/PowerShell/issues/3725 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/275c80be188641417284c5304a10f1e446ade64459a8a33dc5bf4947fc8f9707/PowerShell/PowerShell/issues/3725 |
| og:image:alt | Note: Applies to Linux and macOS, but not to Windows Possibly related: #3724 Wildcard patterns- at least in the context of Get-Item - support ` as the escape character to represent literal ` instan... |
| 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 | ba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353 |
| 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 | ab680789ae4a316cdaf0d5a292a1760140931cc4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width