The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

rmdir - remove directories

 SYNOPSIS



rmdir [-p] dir...

 DESCRIPTION

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.

 OPTIONS

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:
  1. The directory entry it names will be removed.
  2. If the dir operand includes more than one pathname component, effects equivalent to the following command will occur: rmdir -p $(dirname dir)

 OPERANDS

The following operand is supported:
dir
A pathname of an empty directory to be removed.

 STDIN

Not used.

 INPUT FILES

None.

 ENVIRONMENT VARIABLES

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 .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

Not used.

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Each directory entry specified by a dir operand was removed successfully.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

Default.

 APPLICATION USAGE

The definition of an empty directory is one that contains, at most, directory entries for dot and dot-dot.

 EXAMPLES

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:

rmdir -p a/b/c

will remove all three directories.

 FUTURE DIRECTIONS

None.

 SEE ALSO

rm, the XSH specification description of remove(), rmdir(), unlink().

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]