ID EN
OS

rmdir

Python 3.11

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

FileNotFoundError OSError shutil.rmtree() paths relative to directory descriptors auditing event path-like object