Removes a directory.
Standard C Library (libc.a)
#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:
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. |
The chmod or fchmod subroutine, mkdir subroutine, remove (remove Subroutine) subroutine, rename (rename Subroutine) subroutine, umask (umask Subroutine) subroutine, unlink (unlink Subroutine) subroutine.
The rm command, rmdir command.
Files, Directories, and File Systems For Programmers in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.