rmdir()

remove directory 

Function


SYNOPSIS

#include <unistd.h>

int rmdir(const char *pathname);


DESCRIPTION

The rmdir() function removes an empty directory whose name is given by pathname. The directory must not have any entries other than dot (.) and dot-dot (..).

If the directory's link count becomes zero and no process has the directory open or locked, the directory space is freed and the directory is no longer accessible. If one or more processes have the directory open or locked (for example, by having the directory as the current working directory), rmdir() fails and sets errno to EBUSY.


PARAMETERS

pathname 

Points to the directory that the rmdir() function removes.


RETURN VALUES

If successful, rmdir() returns a value of zero. On failure, it returns -1, does not change directory, and sets errno to one of the following values:

EACCES 

Search permission is denied on a component of the pathname prefix.

Write permission is denied on the directory that contains the directory to be removed.

EBUSY 

The directory to be removed is currently in use by the system or another process or the directory to be removed is the current directory of some process.

EEXIST 

pathname names a directory that is not empty; the directory contains entries other than those for dot (.) and dot-dot (..).

EFAULT 

pathname is an invalid pointer.

ENAMETOOLONG 

The length of the pathname parameter exceeds PATH_MAX or a pathname component is longer than NAME_MAX.

ENOENT 

pathname names a nonexistent directory or points to an empty string.


CONFORMANCE

POSIX.1 (1996), with exceptions.


MULTITHREAD SAFETY LEVEL

Async-signal-safe.


PORTING ISSUES

Windows does not let you delete a directory if a user has a lock on it. Any user that is in that directory has a lock on it. All locks to a directory must be resolved before rmdir() can be successful.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
mkdir(), remove(), unlink()


PTC MKS Toolkit 10.4 Documentation Build 39.