BOOL EmptyFolder( LPCTSTR lpszPath)
{
SHFILEOPSTRUCT FileOp;
ZeroMemory( ( void * ) & FileOp, sizeof ( SHFILEOPSTRUCT) ) ;
FileOp. fFlags = FOF_NOCONFIRMATION |
FOF_SILENT
;
FileOp. hNameMappings = NULL ;
FileOp. hwnd = NULL ;
FileOp. lpszProgressTitle = NULL ;
char tempPath[256] = {0};
//使用通配符
memcpy(tempPath,
lpszPath, strlen(
lpszPath
)
);memcpy(&tempPath[strlen(
lpszPath
)], "//*", strlen(//*));
FileOp. pFrom = tempPath
;
FileOp. pTo = NULL ;
FileOp. wFunc = FO_DELETE;
return SHFileOperation( & FileOp) = = 0;
}