Is there an elegant way to get the (great-grandparent folder) three levels up from a folder path?
I'm only looking to get C:\folderA\folderB from the full path, but both solutions just seem ugly to me.
$path = "C:\folderA\folderB\folderC\FolderD\folderE"
# option 1
(Get-Item $path).parent.parent.parent.FullName
# option 2
$path | Split-Path -Parent | Split-Path -Parent | Split-Path -Parent