rmdir -- Remove Directory

Format

#include <direct.h>
int rmdir(char *pathname);

Language Level: XPG4, Extension
rmdir deletes the directory specified by pathname. The directory must be empty, and it must not contain any files or subdirectories.

Note: In earlier releases of the C/C++ run-time library, rmdir began with an underscore (_rmdir). Because it is defined by the X/Open standard, the underscore has been removed. For compatibility, IBM C and C++ Compilers will map _rmdir to rmdir for you.

Return Value
rmdir returns the value 0 if the directory is successfully deleted. A return value of -1 indicates an error, and errno is set to one of the following values:

Value Meaning
EACCESS One of the following has occurred:
  • The given path name is not a directory.
  • The directory is not empty.
  • The directory is read only.
  • The directory is the current working directory or root directory being used by a process.
ENOENT The path name was not found.

Example



chdir -- Change Current Working Directory
_getdcwd -- Get Full Path Name of Current Directory
_getcwd -- Get Path Name of Current Directory
mkdir -- Create New Directory
<direct.h>