Input:- Attachment\Internal\1508001_1013422155337804_2224943720795643293_n.jpg
Ouptput:- Attachment\Internal
how to Remove that extension word (for ex: 1508001_1013422155337804_2224943720795643293_n.jpg) itself..
Input:- Attachment\Internal\1508001_1013422155337804_2224943720795643293_n.jpg
Ouptput:- Attachment\Internal
how to Remove that extension word (for ex: 1508001_1013422155337804_2224943720795643293_n.jpg) itself..
You can use Path.GetDirectoryName
:
var directory = Path.GetDirectoryName(
@"Attachment\Internal\1508001_1013422155337804_2224943720795643293_n.jpg");
Note the use of a verbatim string literal to remove the need to escape the backslashes.