Linux rmdir Command

Linux 命令大全Linux Command Encyclopedia

The Linux rmdir (full English name: remove directory) command deletes empty directories.

Syntax

rmdir [-p] dirName

Parameters:

  • -p: When the subdirectory is deleted and the parent directory becomes empty as a result, delete it as well.
  • Examples

    Delete the subdirectory named AAA under the working directory:

    rmdir AAA

    In the BBB directory under the working directory, delete the subdirectory named Test. If after Test is deleted, the BBB directory becomes an empty directory, then BBB is also deleted.

    rmdir -p BBB/Test

    Linux 命令大全Linux Command Encyclopedia

    Other Extensions