Click here to Skip to main content
15,895,462 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
please, I need native code for copying a given sytem of directories,subdirectories, subsubdirectories etc and their file content.
Posted

Use ShellExecute : http://msdn.microsoft.com/en-us/library/bb762153%28VS.85%29.aspx[^]

With a command like :
xcopy.exe /s /q /y srcdir destdir
 
Share this answer
 
Comments
JF2015 11-Sep-12 0:31am    
This solution is simple but perfect. 5+
Mehdi Gholam 11-Sep-12 0:33am    
Cheers :)
Did you use Google to find a solution?
Here is a nice links that will help you:
http://www.cplusplus.happycodings.com/Algorithms/code38.html[^]
And here is some sample code:
    #include <windows.h>
#include <iostream>
using namespace std;
int main()
{
    SHFILEOPSTRUCT sf;
    memset(&sf,0,sizeof(sf));
    sf.hwnd = 0;
    sf.wFunc = FO_COPY;
    sf.pFrom = "d:\\masm32\\*.*";
    sf.pTo = "d:\\masm33";
    sf.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI;
    int n = SHFileOperation(&sf);
    if( n == 0)
    {
      cout << "Success\n";
    }
    else
    {
      cout << "Failed\n";
    }
}
 
Share this answer
 
Comments
Mehdi Gholam 11-Sep-12 0:29am    
5'ed, just posted the same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900