PDA

View Full Version : [C++] Equivalente di Xcopy in windows.h, esiste?


Abadir_82
29-01-2008, 08:13
Ciao.

Devo effettuare un backup di alcuni singoli file e di alcune cartelle locate in posizioni differenti tra loro.
Per copiare i singoli file la funzione "CopyFile()" funziona a meraviglia, mentre non ho trovato nulla per copiare le directory, cosi' ho dovuto ripiegare sull'Xcopy di dos.

Esiste l'equivalente windows della funzione xcopy di dos?

Grazie.

Abadir_82
31-01-2008, 09:47
Se servira' a qualcuno in futuro ho risolto:



// Copy the files from the mutsig to the backup dir. Create the SHFILEOPSTRUCT and zero it.
memset(src, 0, sizeof(mutsig_folder_path));
memset(dst, 0, sizeof(backup_folder_path));
SHFILEOPSTRUCT fos;
memset(&fos, 0, sizeof(fos));
// Set hwnd to the Handle property to make the application the owner of the progress dialog.
fos.hwnd = Handle;
// Specify a copy operation.
fos.wFunc = FO_COPY;
// Set the from and to parameters.
fos.pFrom = src;
fos.pTo = dst;
// Set the flags.
fos.fFlags = FOF_ALLOWUNDO|FOF_NOCONFIRMMKDIR|FOF_NOCONFIRMATION;
fos.lpszProgressTitle = process_done;
// Do it.
SHFileOperation(&fos);
MessageBox(NULL," THE BACKUP HAS BEEN COMPLETED! "," ",0);