remove directories (POSIX)
rmdir [-p] dir...
Remove the subdirectory oldfiles from the /home/fred directory:
rmdir /home/fred/oldfiles
Remove the directory path dir1/dir2/dir3:
rmdir -p dir1/dir2/dir3
For this command, rmdir first removes dir1/dir2/dir3. If this is successful, it then removes dir1/dir2. If this is also successful, it removes dir1. If all these have been successful, rmdir continues on to remove any additional directories named on the command line, and if no problems occur will exit with a zero exit status. Otherwise, rmdir proceeds to remove any other directories named on the command line, and will exit with a non-zero exit status.
The rmdir utility removes the directory specified by each dir operand, provided the directory is empty.
The rmdir utility processes directories in the order they're specified on the command line. If you specify a parent directory, you should specify its subdirectory before the parent directory. That way, the parent directory will be empty when the rmdir utility tries to remove it.