Hello,
I would like to make a copy function, like xcopy but in c++.I wouldn't use xcopy in my c++ file, because I don't have enough error catching.
I would like to copy the whole directory structure from source to destination, but if the file or directory exists in the destination, it may not be copied again.
I wrote this code. But it doesn't work. Can somebody help me please?
I would like to make a copy function, like xcopy but in c++.I wouldn't use xcopy in my c++ file, because I don't have enough error catching.
I would like to copy the whole directory structure from source to destination, but if the file or directory exists in the destination, it may not be copied again.
I wrote this code. But it doesn't work. Can somebody help me please?
Code:
SHFILEOPSTRUCT fileop;
fileop.hwnd = NULL;
fileop.wFunc = FO_COPY;
fileop.pFrom = "C:\\a\\*.*\0"; // additional null needed
fileop.pTo = "C:\\b\\\0"; // additional null needed
fileop.fFlags = FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR |FOF_RENAMEONCOLLISION;
if (!SHFileOperation(&fileop) == NULL)
{
printf("copy failed");
getchar();
}
Comment