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.
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.
What is the opinion around having the following?
Better naming is left as an exercise for attentive readers with English as their native toungue.