#include <iostream>
#include <Windows.h>
#include <shellapi.h>

int main() {
    // 文件夹路径（以单空字符结尾）
    wchar_t folderPath[] = L"Results\0";  // 注意：适当地使用单空字符结尾

    // 初始化SHFILEOPSTRUCT
    SHFILEOPSTRUCT shfo = {
        NULL,
        FO_DELETE,
        folderPath,   // 指向要删除的文件夹路径
        NULL,
        FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NO_UI, // 不显示确认对话框、错误UI
        FALSE,
        NULL,
        NULL
    };

    // 执行删除操作
    int result = SHFileOperation(&shfo);

    // 检查操作结果
    if (result == 0) {
        std::wcout << L"Folder 'Results' has been deleted successfully." << std::endl;
    }
    else {
        std::wcerr << L"An error occurred while trying to delete the folder." << std::endl;
    }

    return 0;
}