Skip to content

Add get all subdirs function  #10

@rosikand

Description

@rosikand

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 + "/*")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions