title: Delete items within a folder rather than deleing the entire folder itself using vb.net
body: <p>I want to delete all the files contained in a folder. The below code does delete the file but also deletes the folder itself. I am aware you will need to perform a for loop to remove each item from the folder, but can't find the information on how to start the code for it. Can someone point me in the correct direction.</p>
  <pre><code>Dim folderFiles() As String
  folderFiles= Directory.GetFileSystemEntries(&quot;C:\New Folder&quot;)
  
  For Each element As String In files
     If (Not Directory.Exists(folder)) Then
        File.Delete(Path.Combine(&quot;C:\New Folder&quot;, Path.GetFileName(folder)))
     End If
  Next
  </code></pre>