Skip to content

Commit d4f4015

Browse files
(AB-506233) Clarify note in Remove-Item (#12707)
Prior to this change, the `Remove-Item` documentation included a brief note for example 4 meant to indicate that the unusual construction of the command in the example: ```powershell Get-ChildItem * -Include *.csv -Recurse | Remove-Item ``` Is no longer required in Windows version 1909 and later. This change: - Expands on the note to clarify the change in behavior and show how a user can write a more idiomatic statement in later versions of Windows to fulfill the same purpose. - Fixes AB#506233
1 parent 7b44d24 commit d4f4015

File tree

4 files changed

+52
-8
lines changed

4 files changed

+52
-8
lines changed

reference/5.1/Microsoft.PowerShell.Management/Remove-Item.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 02/14/2023
5+
ms.date: 01/28/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/remove-item?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -130,7 +130,18 @@ cmdlet interprets the subject of the search to be a file that has no child items
130130
fails.
131131

132132
> [!NOTE]
133-
> This behavior was fixed in Windows versions 1909 and up.
133+
> Starting in Windows version 1909, specifying the file type in the **Path** parameter when using
134+
> the **Recurse** parameter does recursively discover child items with the given file extension.
135+
>
136+
> In Windows version 1909 and later, the following statements will discover and remove the same
137+
> files:
138+
>
139+
> ```powershell
140+
> # Works in all versions of Windows:
141+
> Get-ChildItem -Path * -Include *.csv -Recurse | Remove-Item
142+
> # Only correctly finds and removes nested CSV files in Windows 1909 and later:
143+
> Get-ChildItem -Path *.csv -Recurse | Remove-Item
144+
> ```
134145
135146
### Example 5: Delete subkeys recursively
136147

reference/7.4/Microsoft.PowerShell.Management/Remove-Item.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 02/14/2023
5+
ms.date: 01/28/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/remove-item?view=powershell-7.4&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -128,7 +128,18 @@ cmdlet interprets the subject of the search to be a file that has no child items
128128
fails.
129129

130130
> [!NOTE]
131-
> This behavior was fixed in Windows versions 1909 and up.
131+
> Starting in Windows version 1909, specifying the file type in the **Path** parameter when using
132+
> the **Recurse** parameter does recursively discover child items with the given file extension.
133+
>
134+
> In Windows version 1909 and later, the following statements will discover and remove the same
135+
> files:
136+
>
137+
> ```powershell
138+
> # Works in all versions of Windows:
139+
> Get-ChildItem -Path * -Include *.csv -Recurse | Remove-Item
140+
> # Only correctly finds and removes nested CSV files in Windows 1909 and later:
141+
> Get-ChildItem -Path *.csv -Recurse | Remove-Item
142+
> ```
132143
133144
### Example 5: Delete subkeys recursively
134145

reference/7.5/Microsoft.PowerShell.Management/Remove-Item.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 02/14/2023
5+
ms.date: 01/28/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/remove-item?view=powershell-7.5&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -128,7 +128,18 @@ cmdlet interprets the subject of the search to be a file that has no child items
128128
fails.
129129

130130
> [!NOTE]
131-
> This behavior was fixed in Windows versions 1909 and up.
131+
> Starting in Windows version 1909, specifying the file type in the **Path** parameter when using
132+
> the **Recurse** parameter does recursively discover child items with the given file extension.
133+
>
134+
> In Windows version 1909 and later, the following statements will discover and remove the same
135+
> files:
136+
>
137+
> ```powershell
138+
> # Works in all versions of Windows:
139+
> Get-ChildItem -Path * -Include *.csv -Recurse | Remove-Item
140+
> # Only correctly finds and removes nested CSV files in Windows 1909 and later:
141+
> Get-ChildItem -Path *.csv -Recurse | Remove-Item
142+
> ```
132143
133144
### Example 5: Delete subkeys recursively
134145

reference/7.6/Microsoft.PowerShell.Management/Remove-Item.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Management
5-
ms.date: 02/14/2023
5+
ms.date: 01/28/2026
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/remove-item?view=powershell-7.6&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
aliases:
@@ -128,7 +128,18 @@ cmdlet interprets the subject of the search to be a file that has no child items
128128
fails.
129129

130130
> [!NOTE]
131-
> This behavior was fixed in Windows versions 1909 and up.
131+
> Starting in Windows version 1909, specifying the file type in the **Path** parameter when using
132+
> the **Recurse** parameter does recursively discover child items with the given file extension.
133+
>
134+
> In Windows version 1909 and later, the following statements will discover and remove the same
135+
> files:
136+
>
137+
> ```powershell
138+
> # Works in all versions of Windows:
139+
> Get-ChildItem -Path * -Include *.csv -Recurse | Remove-Item
140+
> # Only correctly finds and removes nested CSV files in Windows 1909 and later:
141+
> Get-ChildItem -Path *.csv -Recurse | Remove-Item
142+
> ```
132143
133144
### Example 5: Delete subkeys recursively
134145

0 commit comments

Comments
 (0)