2014年9月5日 星期五
vbnet 刪除目錄下所有檔案
Public Shared Sub DeleteDir(ByVal aimPath As String)
Try
If (Not Directory.Exists(aimPath)) Then Exit Sub
Dim fileList() As String = Directory.GetFileSystemEntries(aimPath)
For Each FileName As String In fileList
If (Directory.Exists(FileName)) Then
DeleteDir(aimPath + Path.GetFileName(FileName))
Else
File.Delete(aimPath + Path.GetFileName(FileName))
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言