Directory.GetFiles returns all the way, I want only the file name?

This is the code I installed to scan the file directory:

Dim fileArray() As String fileArray = Directory.GetFiles(System.AppDomain.CurrentDomain.BaseDirectory & "help\") 

And it successfully gets all the files in the directory, but also gets its absolute paths. For example, one of the entries in fileArray() :

 F:\Project\Project\bin\x86\Debug\help\book_troubleshoot.html 

And I want it to be simple:

 book_troubleshoot.html 

Is there a way to do this without parsing all the array entries in order to trim the path?

Thanks.

+4
source share
1 answer
 string filename= System.IO.Path.GetFileName(fullpathname); 
+13
source

Source: https://habr.com/ru/post/1308085/


All Articles