RMDIR(2) | System Calls Manual | RMDIR(2) |
rmdir
— remove a
directory file
#include
<unistd.h>
int
rmdir
(const
char *path);
rmdir
()
removes a directory file whose name is given by path.
The directory must not have any entries other than
‘.
’ and
‘..
’.
There is no
rmdirat
()
function; to remove a directory with a path relative to the directory
associated with a file descriptor use the
unlinkat(2) function with
the AT_REMOVEDIR
flag.
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
The named file is removed unless:
ENOTDIR
]ENAMETOOLONG
]NAME_MAX
characters, or an entire pathname (including the terminating NUL) exceeded
PATH_MAX
bytes.ENOENT
]ELOOP
]ENOTEMPTY
].
’ and
‘..
’ in it.EACCES
]EACCES
]EPERM
]EPERM
]EBUSY
]EINVAL
].
’.EIO
]EROFS
]EFAULT
]rmdir
() function conforms to
IEEE Std 1003.1-2008 (“POSIX.1”).
The rmdir
() function call appeared in
4.1cBSD.
January 11, 2019 | OpenBSD-7.0 |