For example i have a file ISample.cs in this path like
"D:\TEST_SOURCE\CV\SOURCE CODE\ARMY.Data\ProceduresALL\ISample.cs"
Here i wanna the file-path from
"ProceduresAll\ISample.cs"
Before that i don't wanna that path.Here i am using folder browser for choosing the folder.
Please help me regarding this.
You mean like this?
string path = @"D:\TEST_SOURCE\CV\SOURCE CODE\ARMY.Data\ProceduresALL\ISample.cs";
//ISample.cs
Path.GetFileName(path);
//D:\TEST_SOURCE\CV\SOURCE CODE\ARMY.Data\ProceduresALL
Path.GetDirectoryName(path);
//ProceduresALL
Path.GetDirectoryName(path).Split(Path.DirectorySeparatorChar).Last();
Use Path.Combine("ProceduresALL", "ISample.cs") to get ProceduresALL\ISample.cs (using the above to get these strings).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With