首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

vb.net删除目录中文件解决方法

2012-05-11 
vb.net删除目录中文件请问vb.net如何删除指定目录下的所有文件,或指定的文件[解决办法]VB.NET code获取文

vb.net删除目录中文件
请问vb.net如何删除指定目录下的所有文件,或指定的文件

[解决办法]

VB.NET code
'获取文件集合        Public Shared Function GetFileS(ByVal fullPath As String, Optional ByVal fileExt As String = "") As FileInfo()        Dim curDir As New DirectoryInfo(fullPath)        Dim fileInfo As FileInfo()        If fileExt = "" Then            fileInfo = curDir.GetFiles()        Else            fileInfo = curDir.GetFiles(fileExt)        End If        Return fileInfo    End Function    '获取文件夹集合    Public Shared Function GetFolderS(ByVal fullPath As String, Optional ByVal searchPattern As String = "") As DirectoryInfo()        Dim curDir As New DirectoryInfo(fullPath)        Dim dirInfo As DirectoryInfo()        If searchPattern = "" Then            dirInfo = curDir.GetDirectories()        Else            dirInfo = curDir.GetDirectories(searchPattern)        End If        Return dirInfo    End Function 

热点排行