Delete a folder in C++ without emptying it
I searched for a c++ library function to delete a folder ... but did not find any thing which can help me in this regard. So I just found a work around in which I used the RD command to solve my problem.
Code is :
#include
#include// For _getch()
#include// For system command
usingnamespace std;
void main()
{
string fileName = "any folder path";
string cmd = "RD \"";
cmd += fileName;
cmd += "\" /S /Q";
system(cmd.c_str());
cout<<"Done";
_getch();
}
Comments
Post a Comment