-3

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..

1 Answers1

1

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.

Alex Booker
  • 10,487
  • 1
  • 24
  • 34