You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove-Item: adding -Recurse when -Filter is also used ignores the filter, targets *all* items. #20651
Resolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.WG-ReviewedA Working Group has reviewed this and made a recommendation
# Create and switch to a temp. dir.Push-Location ($tmpDir=New-Item-Force -Type Directory (Join-Path temp: $PID))
# Create two sample files and a sample subdir.'1.txt','2.csv'|% { ''>$_ }
$null=New-Item-Force -Type Directory subdir
# Use -Filter *.txt alone Remove-Item*-Filter *.txt -WhatIf
'---'# Use -Filter *.txt with -RecurseRemove-Item*-Filter *.txt -Recurse -WhatIf
# Clean upPop-Location$tmpDir|Remove-Item-Recurse
Expected behavior
What if: Performing the operation "Remove File" on target "/var/folders/_t/8x3_gp2n6lb1mpg106v6vsvc0000gn/T/64474/1.txt".---What if: Performing the operation "Remove File" on target "/var/folders/_t/8x3_gp2n6lb1mpg106v6vsvc0000gn/T/64474/1.txt".
Actual behavior
What if: Performing the operation "Remove File" on target "/var/folders/_t/8x3_gp2n6lb1mpg106v6vsvc0000gn/T/64474/1.txt".---What if: Performing the operation "Remove Directory" on target "/var/folders/_t/8x3_gp2n6lb1mpg106v6vsvc0000gn/T/64474/subdir".What if: Performing the operation "Remove File" on target "/var/folders/_t/8x3_gp2n6lb1mpg106v6vsvc0000gn/T/64474/1.txt".What if: Performing the operation "Remove File" on target "/var/folders/_t/8x3_gp2n6lb1mpg106v6vsvc0000gn/T/64474/2.csv".
That is, all items were targeted when -Recurse was added
changed the title [-]`Remove-Item`: adding `-Recurse` when `-Filter` is also used ignores the filter[/-][+]`Remove-Item`: adding `-Recurse` when `-Filter` is also used ignores the filter, targets *all* items.[/+]on Nov 7, 2023
The Engine WG discussed this. While we agree that it is a bug and would ideally work more like -Include does, we are worried about making a change in this particularly sensitive area and are marking this as wontfix.
Resolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.WG-ReviewedA Working Group has reviewed this and made a recommendation
Activity
[-]`Remove-Item`: adding `-Recurse` when `-Filter` is also used ignores the filter[/-][+]`Remove-Item`: adding `-Recurse` when `-Filter` is also used ignores the filter, targets *all* items.[/+]SeeminglyScience commentedon Apr 15, 2024
The Engine WG discussed this. While we agree that it is a bug and would ideally work more like
-Includedoes, we are worried about making a change in this particularly sensitive area and are marking this aswontfix.microsoft-github-policy-service commentedon Apr 16, 2024
This issue has been marked as won't fix and has not had any activity for 1 day. It has been closed for housekeeping purposes.
microsoft-github-policy-service commentedon Apr 16, 2024
📣 Hey Michael Klement (@mklement0), how did we do? We would love to hear your feedback with the link below! 🗣️
🔗 https://aka.ms/PSRepoFeedback