1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\" and Copyright (C) 1993 Michael Haardt, Ian Jackson.
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
7 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
8 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
10 .TH rmdir 2 (date) "Linux man-pages (unreleased)"
12 rmdir \- delete a directory
15 .RI ( libc ", " \-lc )
18 .B #include <unistd.h>
20 .BI "int rmdir(const char *" pathname );
24 deletes a directory, which must be empty.
26 On success, zero is returned.
27 On error, \-1 is returned, and
29 is set to indicate the error.
33 Write access to the directory containing
35 was not allowed, or one of the directories in the path prefix of
37 did not allow search permission.
39 .BR path_resolution (7).)
43 is currently in use by the system or some process that prevents its
47 is currently used as a mount point
48 or is the root directory of the calling process.
51 .IR pathname " points outside your accessible address space."
60 Too many symbolic links were encountered in resolving
64 .IR pathname " was too long."
67 A directory component in
69 does not exist or is a dangling symbolic link.
72 Insufficient kernel memory was available.
76 or a component used as a directory in
78 is not, in fact, a directory.
82 contains entries other than
88 as its final component.
90 .\" POSIX.1-2001, POSIX.1-2008
95 The directory containing
99 set and the process's effective user ID is neither the user ID
100 of the file to be deleted nor that of the directory containing it,
101 and the process is not privileged (Linux: does not have the
106 The filesystem containing
108 does not support the removal of directories.
112 refers to a directory on a read-only filesystem.
116 POSIX.1-2001, SVr4, 4.3BSD.
118 Infelicities in the protocol underlying NFS can cause the unexpected
119 disappearance of directories which are still being used.