#include <unistd.h>
int rmdir (Path) const char *Path;
The rmdir subroutine removes the directory specified by the Path parameter. If Network File System (NFS) is installed on your system, this path can cross into another node.
For the rmdir subroutine to execute successfully, the calling process must have write access to the parent directory of the Path parameter.
In addition, if the parent directory of Path has the Sticky bit attribute (described in the sys/mode.h file), the calling process must have one of the following:
Upon successful completion, the rmdir subroutine returns a value of 0. Otherwise, a value of -1 is returned, the specified directory is not changed, and the errno global variable is set to indicate the error.
The rmdir subroutine fails and the directory is not deleted if the following errors occur:
EACCES | There is no search permission on a component of the path prefix, or there is no write permission on the parent directory of the directory to be removed. |
EBUSY | The directory is in use as a mount point. |
EEXIST or ENOTEMPTY | The directory named by the Path parameter is not empty. |
ENAMETOOLONG | The length of the Path parameter exceeds PATH_MAX; or a path-name component longer than NAME_MAX and POSIX_NO_TRUNC is in effect. |
ENOENT | The directory named by the Path parameter does not exist, or the Path parameter points to an empty string. |
ENOTDIR | A component specified by the Path parameter is not a directory. |
EINVAL | The directory named by the Path parameter is not well-formed. |
EROFS | The directory named by the Path parameter resides on a read-only file system. |
The rmdir subroutine can be unsuccessful for other reasons. See "Base Operating System Error Codes For Services That Require Path-Name Resolution" for a list of additional errors.
The rmdir subroutine can be unsuccessful for other reasons. See Appendix A, "Base Operating System Error Codes For Services That Require Path-Name Resolution" on page A-1 for a list of additional errors.
If NFS is installed on the system, the rmdir subroutine fails if the following is true:
ETIMEDOUT | The connection timed out. |
This subroutine is part of Base Operating System (BOS) Runtime.
The chmod or fchmod subroutine, mkdir subroutine, remove subroutine, rename subroutine, umask subroutine, unlink subroutine.
The rm command, rmdir command.
Files, Directories, and File Systems For Programmers in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.