I have a file in a folder on a user's local drive. I want to reference it by just the last few folders, how do i do that? example:
string filePath = \\folder\file.txt;
I have a file in a folder on a user's local drive. I want to reference it by just the last few folders, how do i do that? example:
string filePath = \\folder\file.txt;
Use "GetParent"
string path = Directory.GetCurrentDirectory(); //current path
string path1 = Directory.GetParent(path).ToString(); //parent of current path
string path2 = Directory.GetParent(path1).ToString(); //parent..
string path3 = Directory.GetParent(path2).ToString(); //parent..
Optimize it if you really want to use it. It just shows how it works.