This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for

This function deletes an empty directory. A RAPI version of this function exists called CeRemoveDirectory (RAPI).


BOOL RemoveDirectory(



[in] Pointer to a null-terminated string that specifies the path of the directory to be removed. The path must specify an empty directory, and the calling process must have delete access to the directory.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.


This function operates only on empty directories. If the directory is not empty, use the FindFirstFilefunction, the FindNextFilefunction, this function, and the DeleteFilefunction to recursively enumerate and delete the files and subdirectories in the directory.


Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also