I am trying to delete all files from single folder in VB.Net but to keep that folder.
As far as i know, i can delete files by this way:
Dim heart17 As System.IO.FileInfo = New IO.FileInfo("path")
This will help you to delete all files in the specified directory you can specify the search pattern to delete files that satisfies the pattern; some possible search patterns are:
"*.jpg"- selects all
"*.txt"- selects all text files.
"*123.txt"selects all text files whose name ends with
Dim directoryName As String = "your path here" For Each deleteFile In Directory.GetFiles(directoryName ,"*.*",SearchOption.TopDirectoryOnly) File.Delete(deleteFile) Next