Please not that the pFrom and pTo member of the SHFILEOPSTRUCT must be
double-null terminated. That means you need to add an extra '\0' to the end of your string. Plase allocate one char more for your buf_from and buf_to.
Please refer following code:
CString strFrom(_T("C:\\somedir\\*"));
CString strTo(_T("C:\\otherdir"));
SHFILEOPSTRUCT option = {0};
option.hwnd = NULL;
option.wFunc = FO_COPY;
option.fFlags = FOF_NOCONFIRMATION | FOF_RENAMEONCOLLISION;
int nBufSize = strFrom.GetLength() + 2;
LPTSTR pBufFrom = new TCHAR[nBufSize];
::SecureZeroMemory(pBufFrom, nBufSize * sizeof(TCHAR));
StringCchCopy(pBufFrom, nBufSize, strFrom);
option.pFrom = pBufFrom;
nBufSize = strTo.GetLength() + 2;
LPTSTR pBufTo = new TCHAR[nBufSize];
::SecureZeroMemory(pBufTo, nBufSize * sizeof(TCHAR));
StringCchCopy(pBufTo, nBufSize, strTo);
option.pTo = pBufTo;
::SHFileOperation(&option);