Skip to content

Commit 0051103

Browse files
deadlydogsdwheeler
andauthored
docs: Mention PS 5.1 bug where Get-ChildItem ignores -Depth parameter when used with -Include (#11804)
* docs: Mention Windows PowerShell 5 bug where Get-ChildItem ignore -Depth parameter when used with -Include * Minor edit --------- Co-authored-by: Sean Wheeler <[email protected]>
1 parent 08dac93 commit 0051103

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

reference/5.1/Microsoft.PowerShell.Management/Get-ChildItem.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,10 @@ For example, `-Depth 2` includes the **Path** parameter's directory, first level
520520
and second level of subdirectories. By default directory names and filenames are included in the
521521
output.
522522

523+
> [!NOTE]
524+
> The **Depth** parameter has no effect when used with the **Include** parameter. To work around
525+
> this issue, use the **Filter** parameter instead. This is fixed in PowerShell 6 and higher.
526+
523527
> [!NOTE]
524528
> On a Windows computer from PowerShell or **cmd.exe**, you can display a graphical view of a
525529
> directory structure with the **tree.com** command.
@@ -802,6 +806,10 @@ after the inclusions, which can affect the final output.
802806
> The **Include** and **Exclude** parameters have no effect when used with the **LiteralPath**
803807
> parameter. This is fixed in PowerShell 7.
804808

809+
> [!NOTE]
810+
> The **Depth** parameter has no effect when used with the **Include** parameter. To work around
811+
> this issue, use the **Filter** parameter instead. This is fixed in PowerShell 6.
812+
805813
```yaml
806814
Type: System.String[]
807815
Parameter Sets: (All)

0 commit comments

Comments
 (0)