Path.GetDirectoryName の もう1つ上の階層を指定
LastIndexOf と LastIndexOfAny を使うとイイよ。
Dim FilePath As String = "G:\sample1\sample2\sample3\test.txt" Dim UpDir As String = Path.GetDirectoryName(FilePath) 'G:\sample1\sample2\sample3 Dim tempCount As Integer = UpDir.LastIndexOf("\") '18 UpDir = UpDir.Substring(0, tempCount + 1) 'G:\sample1\sample2\ 'もう1つ上 tempCount = UpDir.LastIndexOfAny("\", tempCount - 1) '10 UpDir = UpDir.Substring(0, tempCount + 1) 'G:\sample1\