1RMDIR(2)                   Linux Programmer's Manual                  RMDIR(2)
2
3
4

NAME

6       rmdir - delete a directory
7

SYNOPSIS

9       #include <unistd.h>
10
11       int rmdir(const char *pathname);
12

DESCRIPTION

14       rmdir() deletes a directory, which must be empty.
15

RETURN VALUE

17       On  success,  zero is returned.  On error, -1 is returned, and errno is
18       set appropriately.
19

ERRORS

21       EACCES Write access  to  the  directory  containing  pathname  was  not
22              allowed,  or  one of the directories in the path prefix of path‐
23              name did not allow search permission.   (See  also  path_resolu‐
24              tion(2).
25
26       EBUSY  pathname  is currently in use by the system or some process that
27              prevents its removal.  On Linux this means pathname is currently
28              used  as  a  mount point or is the root directory of the calling
29              process.
30
31       EFAULT pathname points outside your accessible address space.
32
33       EINVAL pathname has .  as last component.
34
35       ELOOP  Too many symbolic links were encountered in resolving pathname.
36
37       ENAMETOOLONG
38              pathname was too long.
39
40       ENOENT A directory component in pathname does not exist or  is  a  dan‐
41              gling symbolic link.
42
43       ENOMEM Insufficient kernel memory was available.
44
45       ENOTDIR
46              pathname,  or  a  component  used as a directory in pathname, is
47              not, in fact, a directory.
48
49       ENOTEMPTY
50              pathname contains entries other than . and .. ; or, pathname has
51              ..  as its final component.
52
53       EPERM  The  directory  containing pathname has the sticky bit (S_ISVTX)
54              set and the process's effective user ID is neither the  user  ID
55              of  the  file to be deleted nor that of the directory containing
56              it, and the process is not privileged (Linux: does not have  the
57              CAP_FOWNER capability).
58
59       EPERM  The  filesystem containing pathname does not support the removal
60              of directories.
61
62       EROFS  pathname refers to a file on a read-only filesystem.
63

CONFORMING TO

65       SVr4, 4.3BSD, POSIX.1-2001.
66

BUGS

68       Infelicities in the protocol underlying NFS can  cause  the  unexpected
69       disappearance of directories which are still being used.
70

SEE ALSO

72       rm(1),  rmdir(1),  chdir(2),  chmod(2), mkdir(2), rename(2), unlink(2),
73       unlinkat(2)
74
75
76
77Linux 2.6.7                       2004-06-23                          RMDIR(2)
Impressum