最近vb2005写了个WinCE的程序,需要采集器读取本机指定文件夹内的文件名,并通过文件名处理每个文件里的内容。
请各位高手指点一下,这个问题困扰我好几天了,一直找不到好的解决办法,再次谢过。
比较着急,有此类开发经验的高手指点一二,谢谢。。。
vb.net如何获取指定文件夹内所有文件的名称
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- threenewbee 2015-11-29 14:12关注
Directory.GetFiles
https://msdn.microsoft.com/zh-cn/library/wz42302f.aspxImports System Imports System.IO Public Class Test Public Shared Sub Main() Try ' Only get files that begin with the letter "c." Dim dirs As String() = Directory.GetFiles("c:\", "c*") '列出C:\下c开头的文件,你需要稍微修改,你的路径,列出所有文件是*.* Console.WriteLine("The number of files starting with c is {0}.", dirs.Length) Dim dir As String For Each dir In dirs Console.WriteLine(dir) Next Catch e As Exception Console.WriteLine("The process failed: {0}", e.ToString()) End Try End Sub End Class
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报