get filename from filepath

  • Thread starter Thread starter Nikhil Patel
  • Start date Start date
N

Nikhil Patel

Hi all,
What is the best way to get the file name from the filepath.

For example: I want to get "MyDoc001.xml" from "C:\MyDocs\MyDoc001.xml".

Thanks.
-Nikhil
 
See the System.IO.Path class and it's static methods, like

System.IO.Path.GetFileName( @"c:\mydocs\mydoc001.xml")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top