plz help to read the dir name
-
hi all i have a txt file a.txt inside the folder D:\myolder\urfolder\folder\a.txt is ther any option to read the name of urfolder.i know only the name of the txt file. want to find the folder name. i know we can find the path by string path = Path.GetFullPath("a.txt"); but i want only the middle folder. plz help me plz.... i tried using substring, but the folder name length differs.... so that is also not possible plz do help me
-
hi all i have a txt file a.txt inside the folder D:\myolder\urfolder\folder\a.txt is ther any option to read the name of urfolder.i know only the name of the txt file. want to find the folder name. i know we can find the path by string path = Path.GetFullPath("a.txt"); but i want only the middle folder. plz help me plz.... i tried using substring, but the folder name length differs.... so that is also not possible plz do help me
use the following code... System.IO.DirectoryInfo di=System.IO.Directory.GetParent(@"D:\myolder\urfolder\folder\a.txt"); string middledirectory=di.parent.Name;
Koushik