You can get the number of files in a folder by doing something like this:
vb Code:
Dim counter As Collections.ObjectModel.ReadOnlyCollection(Of String) counter = My.Computer.FileSystem.GetFiles("C:\Temp\") MessageBox.Show("Found: " & counter.Count.ToString & " files")
If Counter.Count = 0 then no files exist. Just set up your loops etc... to check the value first. If the directory file count doesn't equal 0 then loop through each file and attach. If number of files in a folder does equal 0 then move on to next folder or whatever.




Reply With Quote