mlnext.io.get_folders#
- mlnext.io.get_folders(path: str, *, filter: str = '', absolute: bool = False) List[str] [source]#
Lists all folders in folder.
- Parameters:
path (str) – Path of the directory.
filter (str) – Pattern to match the beginning of the folders names.
absolute (bool) – Whether to return the absolute path or only the foldernames.
- Raises:
ValueError – Raised if folder is not a directory.
- Returns:
Returns a list of the names of the folders.
- Return type:
T.List[str]
Example
>>> # list all folder in a directory >>> get_folders('./resources') ['tasks', 'models']
>>> # Get all folders that start with the letter m >>> get_folders('./resources', filter='m') ['models']
# Get the absolute path of the folders >>> get_folders(‘./resources’, absolute=True) [’…/resources/tasks’, ‘…/resources/models’]