rmdir(2) INTERACTIVE UNIX System rmdir(2)
NAME
rmdir - remove a directory
SYNOPSIS
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 multi-
ple remote machines.
[ENAMETOOLONG] (POSIX Only) The length of the path argument
Rev. 1.2 Page 1
rmdir(2) INTERACTIVE UNIX System rmdir(2)
exceeds {PATH_MAX}, or a path name component
is longer than {NAME_MAX} while
{_POSIX_NO_TRUNC} is in effect.
In addition, a directory will not be removed when all of the
following 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 superuser.
Rev. 1.2 Page 2
rmdir(2) INTERACTIVE UNIX System rmdir(2)
SEE ALSO
mkdir(2).
mkdir(1), rm(1), rmdir(1) in the INTERACTIVE UNIX System
User's/System Administrator's Reference Manual.
DIAGNOSTICS
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned, and errno is set to indi-
cate the error.
Rev. 1.2 Page 3