Hi
You need to provide more explicit details of what you want.
Here is an example where you can edit to make 1 csv file for multiple source folders or, split into separate files one for each source folder (etc)
Option Strict On
Option Explicit On
Imports System.Text
Public Class Form1
Dim path As String = "C:\Users\lesha\Desktop\Test"
Dim ExportPath As String = "C:\Users\lesha\Desktop\Test2"
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' make a separate file for each count
Dim splitup As Boolean = True
' look in all sub folders too
Dim d() As String = IO.Directory.GetDirectories(path, "*", IO.SearchOption.AllDirectories)
For Each s As String In d
Dim t As String = GetF(s)
TextBox1.AppendText(t)
If splitup Then
Dim p As String = IO.Path.Combine(ExportPath, IO.Path.GetFileName(s) & ".csv")
IO.File.AppendAllText(p, t)
Else
Dim p As String = IO.Path.Combine(ExportPath, "COMBINED.csv")
IO.File.AppendAllText(p, t)
End If
Next
End Sub
Function GetF(dir As String) As String
Dim img() As String = IO.Directory.GetFiles(dir, "*.jpg")
Dim lst As String = img.Last
Dim sep As String
Dim sb As New StringBuilder
' to include path at start
sb.Append(dir & ": ")
sb.Append("File count " & img.Count.ToString & ", ")
For Each s As String In img
sep = ", " ' with/without space char
' remove line for no blank lines
If s.ToUpper.Contains(lst.ToUpper) Then sep = vbCrLf & vbCrLf
sb.Append(IO.Path.GetFileNameWithoutExtension(s) & sep)
Next
Return sb.ToString
End Function
End Class