Directory.GetFiles 返回整个路径,我只想要文件名?
这是我设置的用于扫描文件目录的代码:
Dim fileArray() As String
fileArray = Directory.GetFiles(System.AppDomain.CurrentDomain.BaseDirectory & "help\")
它成功获取了目录中的所有文件,但也获取了它们的绝对路径。例如, fileArray()
中的条目之一是:
F:\Project\Project\bin\x86\Debug\help\book_troubleshoot.html
我希望它只是:
book_troubleshoot.html
有没有办法在不解析所有数组条目以修剪路径的情况下执行此操作?
谢谢。
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\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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)