Did you try RemoveDirectory function from windows.h? Directory must be empty if you gonna use this function. So you should first delete the files in the directory i guess.