What I have is a basic program to delete folders created on a given date. The program runs and works however, it's not evaluating sub-directories. Is there something that I am doing wrong or not considering.
Thank you for your help.
Imports System.IO
Public Class FormMain
Private Sub btn_DeleteFolders_Click(sender As Object, e As EventArgs) Handles btn_DeleteFolders.Click
Dim myDate As Date = dt_FolderDate.Value.Date
Dim myRoot As New DirectoryInfo(tb_UNC.Text)
If tb_UNC.Text Is Nothing Then
MessageBox.Show("Please select a directory")
End If
If Not myRoot.Exists Then
MessageBox.Show("Directory doesn't exist")
Exit Sub
End If
For Each myDir In myRoot.EnumerateDirectories("*", SearchOption.AllDirectories)
If myDir.CreationTime.Date = myDate Then
myDir.Delete(True)
End If
Next
End If
End Sub
End Class