Imran Akram's blog

Let's talk about life, technicalities, career opportunities, current affairs and a lot more!

How to get the file name from a full file path?

If you have a full file path like D:\My Documents\myimg.jpg and you want to get just the file name myimg.jpg, you can get it with the help of the Path class in this fashion:- In C# string filename = Path.GetFileName(“D:\My Documents\myimg.jpg“); In VB .NET Dim fileName as String = Path.GetFIleName(“D:\My Documents\myimg.jpg”)

  • Share/Bookmark