Get-ChildItem -Recurse -LiteralPath doesn't find anything
Votes from Connect: 4
Original Date Submitted: 9/14/2014 4:22:48 PM
Description:
Contact Information
Handle: sba
Site Name: PowerShell
Feedback ID: 971502
Frequency: Always Happens
Regression: Yes, this happens in previous released versions
Problem Description:
When 'Get-ChildItem -Recurse -LiteralPath' is run against a directory whose name contains square brackets, no output is produced.
Take a directory with the following contents:
PS> cmd /c dir /s d:\tmp\dir[1]
Volume in drive D is DATA
Volume Serial Number is 0454-9DBF
Directory of d:\tmp\dir[1]
2014-09-14 09:23 <DIR> .
2014-09-14 09:23 <DIR> ..
2014-09-14 09:23 <DIR> subdir
0 File(s) 0 bytes
Directory of d:\tmp\dir[1]\subdir
2014-09-14 09:23 <DIR> .
2014-09-14 09:23 <DIR> ..
2014-09-14 09:23 <DIR> ssdir
0 File(s) 0 bytes
Directory of d:\tmp\dir[1]\subdir\ssdir
2014-09-14 09:23 <DIR> .
2014-09-14 09:23 <DIR> ..
2014-09-14 09:23 12 file.txt
1 File(s) 12 bytes
Total Files Listed:
1 File(s) 12 bytes
8 Dir(s) 463,074,471,936 bytes free
This doesn't produce any output:
PS> gci -Recurse -LiteralPath 'd:/tmp/dir[1]'
Whereas this works:
PS> gci -Recurse -Path 'd:/tmp/dir[1
]'
Directory: D:\tmp\dir[1]
Mode LastWriteTime Length Name
d---- 2014-09-14 09:23 subdir
Directory: D:\tmp\dir[1]\subdir
Mode LastWriteTime Length Name
d---- 2014-09-14 09:23 ssdir
Directory: D:\tmp\dir[1]\subdir\ssdir
Mode LastWriteTime Length Name
-a--- 2014-09-14 09:23 12 file.txt
This is discussed a.o. at https://connect.microsoft.com/PowerShell/feedback/CreateFeedbackForm.aspx?FeedbackFormConfigurationID=434&FeedbackType=1
P.S. There might already be a bug filed for that same issue, but it's currently not possible to search for existing bugs on Connect (browsing is available, but there are more than 2,400 bugs opened...)
Product Studio item created by Connect Synchronizer due to creation of feedback ID 971502 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=971502).
Repro Steps:
gci -Recurse -LiteralPath 'd:/tmp/dir[1]'
no output is produced
Expected Results:
The contents of the directory d:/tmp/dir[1] should be returned
Internal BugId: 11000
