Of course you can do it with all folders, because you can access media files from any location on all Android versions.
So you can also list all JPG files from the root dir of the external storage & all sub-folders in just one step (the same way as I've shown). Of course the app need READ permission on all Android versions.