list_dir_names()

audeer.list_dir_names(path, *, basenames=False, recursive=False, hidden=True)[source]

List of folder names located inside provided path.

Parameters
  • path (str | bytes) – path to directory

  • basenames (bool) – if True return relative path in respect to path

  • recursive (bool) – if True includes subdirectories

  • hidden (bool) – if True includes directories starting with a dot (.)

Return type

list[str]

Returns

list of paths to directories

Raises

Examples

>>> path = audeer.path("path")
>>> _ = mkdir(path, "a", ".b", "c")
>>> audeer.list_dir_names(path, basenames=True)
['a']
>>> audeer.list_dir_names(path, basenames=True, recursive=True)
['a', 'a/.b', 'a/.b/c']
>>> audeer.list_dir_names(path, basenames=True, recursive=True, hidden=False)
['a']