Reputation: 6842
Get-ChildItem -Path "my-path" -Filter "ABGH14__*"
When I run this I get several files that start with the string "ABGH14__" but also a few that obviously DO NOT start with that string in their file name. What can I check?
If I change to use Where-Object
I get list with no extraneous names included.
Why not the first example?
Get-ChildItem -Path "my-path" | Where-Object {$_.Name -like 'ABGH14__*}
Upvotes: 1
Views: 160
Reputation: 27428
Unfortunately, -filter can match the short file name versions.
cmd /c dir /x my-path\ABGH14__* # show short filenames
get-childitem -filter *~1* # would match a lot of short filenames
Upvotes: 1