SHFileOperation
Take a copy as an example.
CString strfrom = ... _t ("src");
CString Strto = ... _t ("dest\\");
Copy the Strfrom folder and its following files and subfolders to the Strto
if (! PathFileExists (Strto))
{
Createwindowdirectory (Strto);// Create destination folder, otherwise Getlastrerror will get error_invalid_handle error
Strto + = _t ("\ \");
Wstring NEW_SF = Source_folder + L "\\*";
WCHAR Sf[max_path + 1];
WCHAR Tf[max_path + 1];
wcscpy_s (SF, MAX_PATH, T2CW (strfrom));
wcscpy_s (TF, MAX_PATH, T2CW (Strto));
SF[LSTRLENW (SF) + 1] = 0;
TF[LSTRLENW (TF) + 1] = 0;
shfileopstructw s = {0};
S.wfunc = fo_copy;//Copy, can also specify delete, etc.
S.pto = TF;
S.pfrom = SF;
S.fflags = Fof_silent | Fof_noconfirmmkdir | fof_noconfirmation | Fof_noerrorui | FOF_NO_UI;
int res = SHFILEOPERATIONW (&s);
}
Windows recursive copy (or delete operations) files