Title: Get-ChildItem -Recurse -Force Aborts With File Paths When Directory Structure Has At Least One Level Exactly Equal To MAX_PATH For Length - And Ignores ErrorAction Options / Introduced With PowerShell 7.2.0-preview.9 · Issue #16123 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-ChildItem -Recurse -Force Aborts With File Paths When Directory Structure Has At Least One Level Exactly Equal To MAX_PATH For Length - And Ignores ErrorAction Options / Introduced With PowerShell 7.2.0-preview.9 · Issue #16123 · PowerShell/PowerShell
X Title: Get-ChildItem -Recurse -Force Aborts With File Paths When Directory Structure Has At Least One Level Exactly Equal To MAX_PATH For Length - And Ignores ErrorAction Options / Introduced With PowerShell 7.2.0-preview.9 · Issue #16123 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/16123
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-ChildItem -Recurse -Force Aborts With File Paths When Directory Structure Has At Least One Level Exactly Equal To MAX_PATH For Length - And Ignores ErrorAction Options / Introduced With PowerShell 7.2.0-preview.9","articleBody":"### Prerequisites\n\n- [X] Write a descriptive title.\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [X] Search the existing issues.\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nI am trying to script to recursively search file systems, and 7.2 preview 9 aborts the Get-ChildItem command with file paths>MAX_PATH (260) chars. This issue does not happen with prior versions.\r\n\r\nExample folder seen in Win 10 that will cause this:\r\n`\"C:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\61be50b1-e59b-45c7-9460-020d3f6bc848\\BaseLayer\\Files\\Program Files (x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\\1.0.1\\Diagnostics\\Simple\"`\r\n\r\n- Found initially when searching for files using: gci -Path C:\\ -Recurse -Force -ErrorAction SilentlyContinue\r\n - The \"Simple\" child folder exceeds MAX_PATH (260) chars and is where it bombs out\r\n - It seems to ignore -ErrorAction SilentlyContinue\r\n\r\n\r\nTo rule out permission issues, I created a separate test folder structure on my D: drive with the same length and had the same results with it:\r\n\r\n```\r\nB:\\Batch>mkdir \"\\\\?\\D:\\DrogramTest\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program Files (x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\\1.0.1\\Diagnostics\\Simple\"\r\n\r\nB:\\Batch>dir \"\\\\?\\D:\\DrogramTest\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program Files (x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\\1.0.1\\Diagnostics\\Simple\"\r\n Volume in drive \\\\?\\D: is Toshiba5TB\r\n Volume Serial Number is 625A-B5E5\r\n\r\n Directory of \\\\?\\D:\\DrogramTest\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program Files (x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\\1.0.1\\Diagnostics\\Simple\r\n\r\n2021.09.19 18:23 \u003cDIR> .\r\n2021.09.19 18:23 \u003cDIR> ..\r\n 0 File(s) 0 bytes\r\n```\r\n\r\nSimply then attempting gci D:\\DrogramTest -Recurse -Force will result in it aborting with the error.\r\n\r\n\r\n\n\n### Expected behavior\n\n```console\nBehavior With 7.2.0 Preview 8 (and prior versions)\r\n\r\nPowerShell 7.2.0-preview.8\r\nCopyright (c) Microsoft Corporation.\r\n\r\nhttps://aka.ms/powershell\r\nType 'help' to get help.\r\n\r\nPS B:\\PSH\\PowerShell-7.2.0-preview.8-win-x64> Get-ChildItem -Path \"C:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program Files (x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\\1.0.1\\\" -Recurse -ErrorAction SilentlyContinue -Force\r\n\r\n Directory:\r\nC:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program\r\nFiles\r\n(x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\\1.0.1\r\n\r\nMode LastWriteTime Length Name\r\n---- ------------- ------ ----\r\nd---- 2021.05.22 09:54 Diagnostics\r\n\r\n Directory:\r\nC:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program\r\nFiles (x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\r\n\\1.0.1\\Diagnostics\r\n\r\nMode LastWriteTime Length Name\r\n---- ------------- ------ ----\r\nd---- 2021.05.22 09:54 Simple\r\n\r\nPS B:\\PSH\\PowerShell-7.2.0-preview.8-win-x64>\n```\n\n\n### Actual behavior\n\n```console\nBehavior With 7.2.0 Preview 9\r\n\r\nPowerShell 7.2.0-preview.9\r\nCopyright (c) Microsoft Corporation.\r\n\r\nhttps://aka.ms/powershell\r\nType 'help' to get help.\r\n\r\nPS B:\\PSH\\PowerShell-7.2.0-preview.9-win-x64> Get-ChildItem -Path \"C:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program Files (x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\\1.0.1\\\" -Recurse -ErrorAction SilentlyContinue -Force\r\n\r\n Directory:\r\nC:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program\r\nFiles\r\n(x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\\1.0.1\r\n\r\nMode LastWriteTime Length Name\r\n---- ------------- ------ ----\r\nd---- 2021.05.22 09:54 Diagnostics\r\n\r\n Directory:\r\nC:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program\r\nFiles (x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\r\n\\1.0.1\\Diagnostics\r\n\r\nMode LastWriteTime Length Name\r\n---- ------------- ------ ----\r\nd---- 2021.05.22 09:54\r\nGet-ChildItem: The system cannot find the path specified.\r\n\r\nPS B:\\PSH\\PowerShell-7.2.0-preview.9-win-x64>\n```\n\n\n### Error details\n\n```console\nPS B:\\> Get-Error\r\n\r\nException :\r\n Type : System.ComponentModel.Win32Exception\r\n NativeErrorCode : 3\r\n ErrorCode : -2147467259\r\n TargetSite :\r\n Name : IsReparsePointLikeSymlink\r\n DeclaringType : Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods\r\n MemberType : Method\r\n Module : System.Management.Automation.dll\r\n Message : The system cannot find the path specified.\r\n Source : System.Management.Automation\r\n HResult : -2147467259\r\n StackTrace :\r\n at Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods.IsReparsePointLikeSymlink(FileSystemInfo\r\nfileInfo) in System.Management.Automation.dll:token 0x60016fa+0x6d\r\n at Microsoft.PowerShell.Commands.FileSystemProvider.Dir(DirectoryInfo directory, Boolean recurse, UInt32 depth,\r\nBoolean nameOnly, ReturnContainers returnContainers, InodeTracker tracker) in System.Management.Automation.dll:token\r\n0x6001657+0x31b\r\n at Microsoft.PowerShell.Commands.FileSystemProvider.Dir(DirectoryInfo directory, Boolean recurse, UInt32 depth,\r\nBoolean nameOnly, ReturnContainers returnContainers, InodeTracker tracker) in System.Management.Automation.dll:token\r\n0x6001657+0x34f\r\n at Microsoft.PowerShell.Commands.FileSystemProvider.GetPathItems(String path, Boolean recurse, UInt32 depth,\r\nBoolean nameOnly, ReturnContainers returnContainers) in System.Management.Automation.dll:token 0x6001656+0x5a\r\n at Microsoft.PowerShell.Commands.FileSystemProvider.GetChildItems(String path, Boolean recurse, UInt32 depth) in\r\nSystem.Management.Automation.dll:token 0x6001653+0x0\r\n at System.Management.Automation.SessionStateInternal.GetChildItems(CmdletProvider providerInstance, String path,\r\nBoolean recurse, UInt32 depth, CmdletProviderContext context) in System.Management.Automation.dll:token 0x6003a8e+0x7\r\nCategoryInfo : NotSpecified: (:) [Get-ChildItem], Win32Exception\r\nFullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.GetChildItemCommand\r\nInvocationInfo :\r\n MyCommand : Get-ChildItem\r\n ScriptLineNumber : 1\r\n OffsetInLine : 1\r\n HistoryId : 1\r\n Line : Get-ChildItem -Path\r\n\"C:\\ProgramData\\Microsoft\\Windows\\Containers\\BaseImages\\283a08b6-ccbf-4c2d-a79e-cab35a294e78\\BaseLayer\\Files\\Program\r\nFiles (x86)\\WindowsPowerShell\\Modules\\Microsoft.PowerShell.Operation.Validation\\1.0.1\\Test\\Modules\\Example2.Diagnostics\r\n\\1.0.1\\\" -Recurse -ErrorAction SilentlyContinue -Force\r\n PositionMessage : At line:1 char:1\r\n + Get-ChildItem -Path \"C:\\ProgramData\\Microsoft\\Windows\\Containers\\Base …\r\n + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n InvocationName : Get-ChildItem\r\n CommandOrigin : Internal\r\nScriptStackTrace : at \u003cScriptBlock>, \u003cNo file>: line 1\n```\n\n\n### Environment data\n\n```powershell\nName Value\r\n---- -----\r\nPSVersion 7.2.0-preview.9\r\nPSEdition Core\r\nGitCommitId 7.2.0-preview.9\r\nOS Microsoft Windows 10.0.21390\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0ΓǪ}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\n```\n\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/BouwenMA","@type":"Person","name":"BouwenMA"},"datePublished":"2021-09-19T22:40:27Z","url":"https://github.com/PowerShell/PowerShell/issues/16123"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:538212c1-54ae-9340-e797-062fe9b134d6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C698:A3D97:36ABCC:4C1800:6AFDE146 |
| html-safe-nonce | f15d9cfedc607c687ce4a87c71077dd48da93379ef29c2c575ae6f0e5069bd59 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjk4OkEzRDk3OjM2QUJDQzo0QzE4MDA6NkFGREUxNDYiLCJ2aXNpdG9yX2lkIjoiMjgyODA1ODQzODAzMjgxMDMxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7a63e1a475ef1e6558f9317fd8e6050b7033d35fb505a5882c76eca5f34f7f20 |
| hovercard-subject-tag | issue:1000438853 |
| 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/16123/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a51b337372314da167304d0294e9f7454977e245c482a3e6c06ac894836ec6b3/PowerShell/PowerShell/issues/16123 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a51b337372314da167304d0294e9f7454977e245c482a3e6c06ac894836ec6b3/PowerShell/PowerShell/issues/16123 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | BouwenMA |
| hostname | github.com |
| expected-hostname | github.com |
| None | 90d7884679efe0f89b35e0eef84213a75179f38d11a62f2a0af551bbe5110799 |
| 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 | 89e3d4b2f59ef440fc496c853aee1d9a06a137d6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width