Open
Description
RFC:
Author: John Bevan
Status: Draft
SupercededBy:
Version:
Area: Standard Functions
Comments Due:
Plan to implement:
Get-ChildItem; Add IncludeRoot Switch
Suggestion: Currently if you wish to fetch an item and its children you have to make a call to Get-Item
and Get-ChildItem
. Since this is a common use case, it would be good to reduce this to a single call. By adding an IncludeRoot
switch to Get-ChildItem
we could easily have it fulfill this requirement.
Here are some examples of people who've hit this scenario & tried to get creative in resolving it.
Motivation
As a PowerShell user,
I can retrieve an item and its children,
so that I have the full tree returned in a single result set.
User Experience
Example of user experience with example code/script.
Include example of input and output.
Get-ChildItem -Path 'c:\demo' -IncludeRoot -Recurse | Select-Object -ExpandProperty FullName
c:\demo
c:\demo\subfolder
c:\demo\subfolder\one.txt
c:\demo\subfolder\two.txt
Specification
Include [Parameter()][Switch]$IncludeRoot
in the list of available parameters.
Alternate Proposals and Considerations
The current workaround is to make separate calls to Get-Item
and Get-ChildItem
.
Metadata
Metadata
Assignees
Labels
No labels