Open rosikand opened 1 year ago
In ML and vision, it is common to loop through a directory and retrieve all subdirectories. Thus, implement the following:
from glob import glob def get_subdirs(root_path): return glob(root_path + "/*/", recursive = True)
avoids the need for the complicated import, adding the /*/ at the end of the path, and also the recursive parameter. Could also be useful to have a function that subsequently gets all files in that subdir:
/*/
def get_files(root_path): return glob(root_path + "/*")
In ML and vision, it is common to loop through a directory and retrieve all subdirectories. Thus, implement the following:
avoids the need for the complicated import, adding the
/*/
at the end of the path, and also the recursive parameter. Could also be useful to have a function that subsequently gets all files in that subdir: