How to read images and masks from multiple folders?

Hi, I was able to train models using images from one “images” folder and masks from another “labels” folder. All tutorials from lesson1-4 have a few hundred images and masks. Now I am trying to run more than 200k images and masks that are distributed in multiple folders. What is the easiest way to load them?

The file structure looks like this

Folder
 - subfolder1
    - blah_blah1.img
    - blah_blah2.img
 - subfolder2
    - blah_blah1.img
    - blah_blah2.img
 - subfolder3
    - blah_blah1.img
    - blah_blah2.img