NAME [Toc] [Back]
rmdir - remove directories
SYNOPSIS [Toc] [Back]
rmdir [-f|-i] [-p] dir ...
DESCRIPTION [Toc] [Back]
rmdir removes the directory entry for each dir operand that refers to
an empty directory.
Directories are removed in the order specified. Consequently, if a
directory and a subdirectory of that directory are both specified as
arguments, the subdirectory must be specified before the parent
directory so that the parent directory will be empty when rmdir tries
to remove it. Removal of a directory requires write and search
(execute) permission in its parent directory, but no permissions on
the directory itself; but if the sticky bit is set on the parent
directory, only the owner of the directory, the owner of the parent
directory, or a user having appropriate privileges can remove the
Options [Toc] [Back]
rmdir recognizes the following options:
-f Force each directory to be removed without prompting for
confirmation, regardless of the presence of the -i option.
This option also suppresses diagnostic messages regarding
This option does not suppress any diagnostic messages other
than those regarding non-existent operands. To suppress all
error message and interactive prompts, the -f option should
be used while redirecting the standard error output to
This option ignores any previous occurrence of the -i
-i Write a prompt to the standard error output requesting
confirmation before removing each directory.
This option ignores any previous occurrence of the -f
-p Path removal. If, after removing a directory with more than
one pathname component, the parent directory of that
directory is now empty, rmdir removes the empty parent
directory. This continues until rmdir encounters a nonempty
parent directory, or until all components of the
original pathname have been removed.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
When used in conjunction with the -i option, rmdir asks
whether to remove each directory component of a path.
EXTERNAL INFLUENCES [Toc] [Back]
LANG provides a default value for the internationalization variables
that are unset or null. If LANG is unset or null, the default value of
"C" (see lang(5)) is used. If any of the internationalization
variables contains an invalid setting, rmdir will behave as if all
internationalization variables are set to "C". See environ(5).
LC_ALL If set to a non-empty string value, overrides the values of all
the other internationalization variables.
LC_CTYPE determines the interpretation of dir names as single and/or
multi-byte characters, the classification of characters as printable,
and the characters matched by character class expressions in regular
LC_MESSAGES determines the locale that should be used to affect the
format and contents of diagnostic messages written to standard error
and informative messages written to standard output.
NLSPATH determines the location of message catalogues for the
processing of LC_MESSAGES.
International Code Set Support [Toc] [Back]
Single- and multi-byte character code sets are supported.
DIAGNOSTICS [Toc] [Back]
Generally self-explanatory. Note that the -f option does not suppress
all diagnostic messages.
EXAMPLES [Toc] [Back]
To remove directories with a prompt for verification:
rmdir -i directories
To remove as much as possible of a path, type:
rmdir -p component1/component2/dir
SEE ALSO [Toc] [Back]
rm(1), rmdir(2), stat(2).
STANDARDS CONFORMANCE [Toc] [Back]
rmdir: SVID2, XPG2, XPG3, XPG4
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003 [ Back ]