make os.listdir(self.image_folder) process subfolders as well
- User
make os.listdir(self.image_folder) process subfolders as well
- Assistant
The
os.listdir()function in Python only lists the contents (files and directories) within the directory specified by the given path, without recursing into subdirectories. If you want to list files in a directory and its subdirectories, you can use theos.walk()function or theglobmodule with recursive patterns. Below are examples of both approaches: