rmdir(2) CLIX rmdir(2)
NAME
rmdir - Removes a directory file
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
int rmdir(
char *path );
PARAMETERS
path Points to the directory pathname.
DESCRIPTION
The rmdir() function removes the directory specified by the path
parameter. The directory must have no entries other than current (.) and
parent (..) directories.
For rmdir() to execute successfully, the calling process must have write
access to the parent directory of the path parameter.
EXAMPLES
if (rmdir(directory_name) == -1)
perror("Rmdir failed");
RETURN VALUES
Upon successful completion, rmdir() returns a value of 0. If rmdir()
fails, a value of -1 is returned, and the global variable errno is set to
indicate the error.
ERRORS
The rmdir() function fails and the directory is not deleted if the
following errors occur:
[EBUSY]
The directory to be removed is the mount point for a mounted file
system.
[EEXIST]
The directory named by the path contains entries other than those
for current (.) and parent (..) directories.
2/94 - Intergraph Corporation 1
rmdir(2) CLIX rmdir(2)
[ENOENT]
The directory named by the path parameter does not exist.
[EINVAL]
The directory to be removed is the current directory of the process
that issued the rmdir() function or the ``.'' entry of a directory.
[EROFS]
The directory named by the path parameter resides on a read-only
file system.
[EACCES]
Search permission is denied on a component of the path prefix, or
write permission is denied on the parent directory of the directory
to be removed.
[ENAMETOOLONG]
The length of the path parameter exceeds PATH_MAX or a pathname
component is longer than NAME_MAX.
[ENOTDIR]
A component of the path is not a directory.
[EFAULT]
The path parameter points outside the process' allocated address
space.
[EIO] An I/O error occurred while accessing the file system.
[ENOLINK]
The path parameter 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.
RELATED INFORMATION
Commands: rmdir(1), rm(1), mkdir(1)
Functions: chmod(2), mkdir(2)
2 Intergraph Corporation - 2/94