This is a refinement of what you suggested:I forgot we were in C# land. If you need me to convert let me know.vb.net Code:
Private Function GetOriginalPath(ByVal path As String) As String Dim root As String = IO.Path.GetPathRoot(path) Dim nodes As New Stack(Of String) While path <> root nodes.Push(IO.Path.GetFileName(path)) path = IO.Path.GetDirectoryName(path) End While Dim node As String Dim originalPath As String = root.ToUpper() While nodes.Count > 0 node = nodes.Pop originalPath = IO.Directory.GetDirectories(originalPath, node)(0) End While Return originalPath End Function




Reply With Quote