can any1 help me with my code because i cant delete and copy a folder but i can copy and delete other file extensions in my code. it would be a great help if you can help me with this cause im new in c++...thank you and godbless.

code for the copy:

#include "stdafx.h"
#include <windows.h>
#include <conio.h>



int _tmain(int argc, _TCHAR* argv[])
{


    CopyFile(argv[1],argv[2],TRUE);


    getch();
    return 0;

}

code for the delete:

#include "stdafx.h"
#include <windows.h>
#include <conio.h>



int _tmain(int argc, _TCHAR* argv[])
{

    DeleteFile(argv[1]);



    getch();
    return 0;

}

Try using the RemoveDirectory function

To copy a folder, you'll probably have to create the new folder and literate through the filea and sub folders and copy them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.