RMDIR(S) UNIX System V RMDIR(S)
Name
rmdir - remove a directory
Syntax
int rmdir (path)
char *path;
Description
rmdir removes the directory named by the path name pointed
to by path. The directory must not have any entries other
than "." and "..".
The named directory is removed unless one or more of the
following is true:
[EINVAL] The current directory may not be removed.
[EINVAL] The "." entry of a directory may not be
removed.
[EEXIST] The directory contains entries other than
those for "." and "..".
[ENOTDIR] A component of the path prefix is not a
directory.
[ENOENT] The named directory does not exist.
[EACCES] Search permission is denied for a component
of the path prefix.
[EACCES] Write permission is denied on the directory
containing the directory to be removed.
[EBUSY] The directory to be removed is the mount
point for a mounted file system.
[EROFS] The directory entry to be removed is part of
a read-only file system.
[EFAULT] path points outside the process's allocated
address space.
[EIO] An I/O error occurred while accessing the
file system.
[ENOLINK] path points to a remote machine, and the link
to that machine is no longer active.
[EMULTIHOP] Components of path require hopping to
multiple remote machines.
In addition, a directory will not be removed when all of the
following conditions are true:
the parent directory has the sticky bit set
the parent directory is not owned by the user
the directory is not owned by the user
the directory is not writable by the user
the user is not super-user
See Also
mkdir(S)
rmdir(C), rm(C), and mkdir(C).
Diagnostics
Upon successful completion, a value of 0 is returned.
Otherwise, a value of -1 is returned and errno is set to
indicate the error.
Standards Conformance
rmdir is conformant with:
AT&T SVID Issue 2, Select Code 307-127;
The X/Open Portability Guide II of January 1987;
IEEE POSIX Std 1003.1-1988 with C Standard Language-
Dependent System Support;
and NIST FIPS 151-1.
(printed 6/20/89)