rmdir()

audeer.rmdir(path, *paths, follow_symlink=True)[source]

Remove directory.

Remove the directory and all its content if the directory exists.

Parameters
  • path (str | bytes) – absolute or relative path of directory to remove

  • *paths (Sequence[str | bytes]) – additional arguments to be joined with path by os.path.join()

  • follow_symlink (bool) – if True and path is a symbolic link, the link and the folder it points to will be removed

Raises

Examples

>>> path = audeer.mkdir("path1")
>>> _ = audeer.mkdir(path, "path2", "path3")
>>> audeer.list_dir_names(path, basenames=True)
['path2']
>>> audeer.rmdir(path, "path2")
>>> audeer.list_dir_names(path)
[]