Remove (delete) the directory path. If the directory does not exist or is not empty, a FileNotFoundError or an OSError is raised respectively. In order to remove whole directory trees, shutil.rmtree() can be used.
Syntax
PYTHON
os.rmdir(path, *, dir_fd=None)
See Also
FileNotFoundErrorOSErrorshutil.rmtree()paths relative to directory descriptorsauditing eventpath-like object