c# 4.0 - Can we split the Filepath from the last folder in C#? -


for example have file isample.cs in path

"d:\test_source\cv\source code\army.data\proceduresall\isample.cs" 

here wanna file-path

"proceduresall\isample.cs" 

before don't wanna path.here using folder browser choosing folder.

please me regarding this.

you mean 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") proceduresall\isample.cs (using above these strings).


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -