命令行删除、复制、移动文件
删除
std::string Name = ".\\xxx\\xxx1";
std::string delcommand = "del /Q /S /F \"" + Name + "\\*\"";
system(delcommand.c_str());
复制
std::string Name1 = ".\\xxx\\xxx";
std::string Name = ".\\xxx\\xxx1";
std::string copycommand = "xcopy \"" + Name1 + "\" \"" + Name + "\" /E /I /H";
system(copycommand.c_str());
移动
若新文件夹存在,则是将旧文件包括文件夹也会一并移动;
若新文件夹不存在,只是移动旧文件夹中文件
const char* Name1 = ".\\xx\\xxx";
const char* Name = ".\\xxx\\xxx1";
std::string movecommand = "move ";
movecommand = movecommand + "\"" + Name1 + "\"" + " " + "\"" + Name + "\"";
system(movecommand .c_str());
// 删除、复制文件
/*std::string tracheName1 = ".\\deeplearning\\trachea";
std::string jsonName1 = ".\\deeplearning\\testjson";
std::string delcommand = "del /Q /S /F \"" + jsonName1 + "\\*\"";
system(delcommand.c_str());
std::string copycommand = "xcopy \"" + tracheName1 + "\" \"" + jsonName1 + "\" /E /I /H";
system(copycommand.c_str());*/