Given a folder and subfolders all containing jpeg files, what function can I write an function to pull a random file from it, every time the function is called.
For example say we have the follwing directory structure:
root_directory/
├── image_1.jpg
├── child_directory_1/
│ ├── image_1.jpg
│ └── image_2.jpg
└── child_direcory_2/
├── child_directory_2_1/
│ └── image_1.jpg
└── child_directory_2_1/
└── image_1.jpg
Is there a way to open a random image when the location of root_directory
is specified.