This PR enhances the file search functionality to include subdirectories by using glob.glob with the recursive=True parameter. This change ensures that all image files within the specified directory and its subdirectories are found, improving the flexibility and robustness of the file search.
Fixed issue
Replaced pathlib.Path.glob with glob.glob to enable recursive search.
Ensured compatibility with existing code by maintaining the use of standard libraries.
Details
# Before
files = sorted(
[file for ext in IMAGE_EXTENSIONS for file in path.glob("*.{}".format(ext))]
)
# After
import glob
files = sorted([file for ext in IMAGE_EXTENSIONS for file in glob.glob(os.path.join(path, '**/*.{}'.format(ext)), recursive=True)])
This PR enhances the file search functionality to include subdirectories by using
glob.glob
with therecursive=True
parameter. This change ensures that all image files within the specified directory and its subdirectories are found, improving the flexibility and robustness of the file search.Fixed issue
pathlib.Path.glob
withglob.glob
to enable recursive search.Details