Sorry, I obviously didn't explain properly.
Some of my image folders have thousands of images and they may also have sub folders as well
I want to find the sub folders only and searching the whole folder, using your routine above, can take 30 to 40 seconds.
If I can sort the items in the folder so the folders come first, when I find an entry containing a ".", I can assume there are no more folders, so can exit the loop.