From b3974152139b026bc07ac08a737e4aa25a653a3c Mon Sep 17 00:00:00 2001 From: deadlydog Date: Fri, 14 Feb 2025 12:13:07 -0600 Subject: [PATCH 1/2] docs: Mention Windows PowerShell 5 bug where Get-ChildItem ignore -Depth parameter when used with -Include --- .../5.1/Microsoft.PowerShell.Management/Get-ChildItem.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md b/reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md index 2d2a85723121..e9a88ca12bd2 100644 --- a/reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md +++ b/reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md @@ -520,6 +520,10 @@ For example, `-Depth 2` includes the **Path** parameter's directory, first level and second level of subdirectories. By default directory names and filenames are included in the output. +> [!NOTE] +> The **Depth** parameter has no effect when used with the **Include** parameter. To work around +> this issue, use the **Filter** parameter instead. This is fixed in PowerShell 6. + > [!NOTE] > On a Windows computer from PowerShell or **cmd.exe**, you can display a graphical view of a > directory structure with the **tree.com** command. @@ -802,6 +806,10 @@ after the inclusions, which can affect the final output. > The **Include** and **Exclude** parameters have no effect when used with the **LiteralPath** > parameter. This is fixed in PowerShell 7. +> [!NOTE] +> The **Depth** parameter has no effect when used with the **Include** parameter. To work around +> this issue, use the **Filter** parameter instead. This is fixed in PowerShell 6. + ```yaml Type: System.String[] Parameter Sets: (All) From d0735848f417a6e2e7ff7aac63cf7b898bf718d5 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Tue, 18 Feb 2025 09:28:29 -0600 Subject: [PATCH 2/2] Minor edit --- reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md b/reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md index e9a88ca12bd2..61612aa3b1d8 100644 --- a/reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md +++ b/reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md @@ -522,7 +522,7 @@ output. > [!NOTE] > The **Depth** parameter has no effect when used with the **Include** parameter. To work around -> this issue, use the **Filter** parameter instead. This is fixed in PowerShell 6. +> this issue, use the **Filter** parameter instead. This is fixed in PowerShell 6 and higher. > [!NOTE] > On a Windows computer from PowerShell or **cmd.exe**, you can display a graphical view of a