Forrest logo
tool overview
On this page you find all important commands for the CLI tool rmdir. If the command you are looking for is missing please ask our AI.

rmdir

The "rmdir" command line tool is used to remove directories in a command line or terminal interface.

It stands for "remove directory" and is available in various operating systems, including Unix, Linux, and Windows.

The basic syntax for using this command is "rmdir directory_name", where "directory_name" is the name of the directory you wish to delete.

By default, the command only works if the directory is empty. If the specified directory has any files or other subdirectories, rmdir will throw an error.

To overcome this limitation, you can use the "-r" or "--recursive" flag, which allows the removal of non-empty directories by recursively deleting all the files and subdirectories within them.

An optional "-p" or "--parents" flag can be used to remove the directory and its parent directories if they become empty after deletion.

The "rmdir" command does not provide any confirmation prompts, so it is important to exercise caution while using it.

If a directory is deleted successfully, the command does not provide any output or confirmation message. It is best practice to check the directory's existence after executing the command.

To preserve a deleted directory and its contents as a backup, it is recommended to make a copy before using the "rmdir" command.

To view additional options and detailed information about using "rmdir", you can refer to the command's documentation or access the built-in help using the "--help" parameter.

List of commands for rmdir:

  • rmdir:tldr:2dd40 rmdir: Remove a directory and its contents recursively.
    $ rmdir ${path\to\directory} /s
    try on your machine
    explain this command
  • rmdir:tldr:3bcd3 rmdir: Remove specific directories.
    $ rmdir ${path-to-directory1 path-to-directory2 ---}
    try on your machine
    explain this command
  • rmdir:tldr:69c26 rmdir: Remove specific nested directories recursively.
    $ rmdir -p ${path-to-directory1 path-to-directory2 ---}
    try on your machine
    explain this command
  • rmdir:tldr:a6b75 rmdir: Remove specific nested directories recursively.
    $ rmdir --parents ${path-to-directory1 path-to-directory2 ---}
    try on your machine
    explain this command
  • rmdir:tldr:f2d58 rmdir: Remove a directory and its contents recursively without prompting.
    $ rmdir ${path\to\directory} /s /q
    try on your machine
    explain this command
tool overview