rmdir(S) 6 January 1993 rmdir(S) Name rmdir - remove a directory Syntax cc ... -lc int rmdir (path) char *path; Description rmdir removes the directory named by the pathname pointed to by path. The directory must not have any entries other than ``.'' and ``..''. A directory is not 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 Return value Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. Diagnostics The rmdir function will fail if: [EACCES] + Search permission is denied for a component of the path prefix. + 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 filesystem. [EEXIST] The directory contains entries other than those for ``.'' and``..''. [EFAULT] path points outside the process's allocated address space. [EINVAL] + The current directory may not be removed. + The ``.'' entry of a directory may not be removed. [EIO] An I/O error occurred while accessing the filesystem. [EMULTIHOP] Components of path require hopping to multiple remote ma- chines. [ENOENT] The named directory does not exist. [ENOLINK] path points to a remote machine, and the link to that ma- chine is no longer active. [ENOTDIR] A component of the path prefix is not a directory. [EROFS] The directory entry to be removed is part of a read-only filesystem. See also mkdir(C), mkdir(S), rmdir(C), rm(C) Standards conformance rmdir is conformant with: AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1.