Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add Levels/Count/AncestorCount to Split-Path -Parent parameter set #6659

Copy link
Copy link
@powercode

Description

@powercode
Issue body actions

I quite often end up in situations where I need to remove a known number of directories from the end of a path.

Today, it requires a looping or piping multiple times to split-path.

$ancestorLevel = 4
$p = "a\b\c\d\e\f"
while($ancestorLevel--){
   $p = split-path $p
}
$p

What is the opinion around having the following?

Split-Path -Parent a\b\c\d\e\f -AncestorLevel 2
a\b\c\d

Split-Path -Parent a\b\c\d\e\f -AncestorLevel 4
a\b

Better naming is left as an exercise for attentive readers with English as their native toungue.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.