commands

rmdir — remove empty directories

Removes empty directories, refusing nonempty ones. A refusal is a reason to inspect, not to switch blindly to recursive deletion. Examples assume a fresh chapter files lab.

Formal Syntax & Structure

linux syntaxlinux
rmdir [OPTION]... DIRECTORY...

Parameters & Attributes

NameTypeDescription
DIRECTORYoperandEmpty directory to remove

Return Value

filesystem change and exit status

GNU rmdir returns 0 when the requested removal succeeds and nonzero on failure; a nonempty directory is normally refused. Check remaining paths if multiple operands were supplied.

Working Example

Example Snippetlinux
rmdir empty
Linux Reference