This code runs on my phone in release with 156ms. And i have over 1k folders and over 10k images.
Dim tmp_lst As List : tmp_lst.Initialize
GetAllFolders(tmp_lst,File.DirRootExternal,File.DirRootExternal)
For Each image_path As String In tmp_lst
Log(image_path)...