开发者

Directory.GetFiles returning entire path, I only want the filename?

开发者 https://www.devze.com 2022-12-28 01:25 出处:网络
This is the code I have set up to scan a directory of files: Dim fileArray() As String fileArray = Directory.GetFiles(System.AppDomain.CurrentDomain.BaseDirectory & \"help\\\")

This is the code I have set up to scan a directory of files:

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

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

F:\Project\Project\bin\x86\开发者_JS百科Debug\help\book_troubleshoot.html

And I want it to just be:

book_troubleshoot.html

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

Thanks.


string filename= System.IO.Path.GetFileName(fullpathname);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号