rmdir - Delete Directories

You can delete the directory using the rmdir command.

rmdir DirectoryName

If the directory is not empty, it cannot be deleted.

How to delete if the directory is not empty?

The rmdir command can only be deleted if the contents of the directory are empty.

To delete a directory if it is not empty, use the "-r" option of the "rm command".

See the explanation of the rm command.

Show help --help option

Use the "--help" option to get help.

rmdir --help

Help is displayed.

Usage: rmdir [OPTION] ... DIRECTORY ...
Remove the DIRECTORY (ies), if they are empty.

                  ignore each failure that is solely because a directory
                  is non-empty
  -p, --parents Remove DIRECTORY and its ancestors. E.g., `rmdir -p a / b / c'is
                  similar to `rmdir a / b / c a / b a'.
  -v, --verbose output a diagnostic for every directory processed
      --help display this help and exit
      --version output version information and exit

Associated Information