rmdir - remove directories
rmdir [-p] dir...
The rmdir utility will remove the directory entry specified by each dir operand, which must refer to an empty directory.Directories will be processed in the order specified. If a directory and a subdirectory of that directory are specified in a single invocation of the rmdir utility, the subdirectory must be specified before the parent directory so that the parent directory will be empty when the rmdir utility tries to remove it.
The rmdir utility supports the XBD specification, Utility Syntax Guidelines .The following option is supported:
- -p
- Remove all directories in a pathname. For each dir operand:
- The directory entry it names will be removed.
- If the dir operand includes more than one pathname component, effects equivalent to the following command will occur:
rmdir -p $(dirname dir)
The following operand is supported:
- dir
- A pathname of an empty directory to be removed.
Not used.
None.
The following environment variables affect the execution of rmdir:
- LANG
- Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
- LC_ALL
- If set to a non-empty string value, override the values of all the other internationalisation variables.
- LC_CTYPE
- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
- LC_MESSAGES
- Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
- NLSPATH
- Determine the location of message catalogues for the processing of LC_MESSAGES .
Default.
Not used.
Used only for diagnostic messages.
None.
None.
The following exit values are returned:
- 0
- Each directory entry specified by a dir operand was removed successfully.
- >0
- An error occurred.
Default.
The definition of an empty directory is one that contains, at most, directory entries for dot and dot-dot.
If a directory a in the current directory is empty except it contains a directory b and a/b is empty except it contains a directory c:will remove all three directories.rmdir -p a/b/c
None.
rm, the XSH specification description of remove(), rmdir(), unlink().