Make Delete Directory
A five-line C program that creates a directory with CreateDirectory, waits, and removes it again with RemoveDirectory.
The bare minimum for the two directory APIs: CreateDirectory makes a single new folder (it does not create intermediate parents - use SHCreateDirectoryEx or recurse if you need a\b\c), and RemoveDirectory deletes it again. The sleep(5000) in between just keeps the folder around long enough to see it on the desktop. Handy as a quick sanity check of both calls; note that RemoveDirectory only works on empty directories.
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
CreateDirectory("C:/Windows/Desktop/My Dir",0);
sleep(5000);
RemoveDirectory("C:/Windows/Desktop/My Dir");
return 0;
}
For recursive deletion of a whole tree, combine FindFirstFile/FindNextFile with DeleteFile and RemoveDirectory bottom-up - or call SHDeleteIDList/IFileOperation from the shell API.