No one seems to ask this simple question, so I will.
My PowerShell script file is located: C:/this-folder/that-folder/another-folder/powershell-file.ps1
C:/this-folder/that-folder/another-folder/powershell-file.ps1
You can use standard .Net method
$dirName=[System.IO.Path]::GetDirectoryName("c:\temp\abc\myproj1\newdata.txt")
From http://techibee.com/powershell/powershell-get-parent-directory-name-from-file-or-directory-path/2595