rmdir(C)
rmdir --
remove directories
Syntax
rmdir [ -p ] [ -s ]
dirname ...
Description
The rmdir command removes the entries for one or more
sub-directories from a directory. A directory must be empty before
it can be removed. (Note that the rm -r dir
command is a more dangerous alternative to rmdir.) If the
parent directory has the ``sticky'' bit set, removal occurs only if
one of the following is true:
-
the parent directory is owned by the user
-
the dirname directory is owned by the user
-
the dirname directory is writable to the user
-
the user is root
rmdir takes the following options:
-p-
Recursively remove the directory dirname and those of its
parent directories that become empty when a subdirectory is
removed. (For example, if a series of empty nested directories
exist, the -p option removes the deepest subdirectory and
all its parent directories until a non-empty directory is reached.)
A message is printed on the standard output if part of the path
remains for some reason.
-s -
Suppress any messages being printed when -p is in effect.
rmdir will refuse to remove the root directory of a
mounted filesystem.
Exit values
rmdir returns an exit code of 0 if all the specified
directories are removed successfully. Otherwise, it returns a
non-zero exit code.
Examples
To remove the directory tmpdir from the current directory:
rmdir tmpdir
To remove the subdirectory dir3 and its parent directories
dir2 and dir1 (where the parent directories
contain no other files):
$ pwd
/u/homedir/dir1/dir2/dir3
$ cd ../../..
$ rmdir -p dir1/dir2/dir3
rmdir: dir1/dir2/dir3: Whole path removed.
See also
rm(C)
Standards conformance
rmdir is conformant with:
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.
Notices
A version of rmdir
that can handle files greater than 2GB
is available in /u95/bin. See
rmdir(1)
for more information.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005