Dim filename As String = Server.MapPath("TEXTFILE/")
Dim root As New DirectoryInfo(filename)
Dim files As FileInfo() = root.GetFiles()
For Each file As FileInfo In files
Dim FileIn As New FileInfo(file.Name)
FileIn.Delete()
Response.Write(file.Name & " Delete <br>")
Next
Private Sub DELETEALLFILE()
Dim Dire() As DirectoryInfo
Dim file() As FileInfo
Dim i As Integer
Dim dir As New DirectoryInfo(Server.MapPath("TEXTFILE/"))
Dire = dir.GetDirectories()
file = dir.GetFiles()
If Dire.Length > 0 Then
For i = 0 To Dire.Length - 1
Dire(i).Delete(True)
Next
End If
If file.Length > 0 Then
For i = 0 To file.Length - 1
file(i).Delete()
Next
End If
End Sub