I used what's below to delete a directory. It only deletes the directory if it's empty. How could I delete a directory and it's contents?

#include <unistd.h>

int main()
{
    rmdir("C:\\haha");
    return 0;
}

The command for deleting folder not empty is:

rmdir /S/Q directory.
The /S will delete directories not empty but asking for Y/N.
The /Q will not ask at all.

This article has been dead for over six months. Start a new discussion instead.