c++移动文件夹

bool Files::MoveSampleFolder(string src_path,string dst_path)
{
    int index = src_path.find_last_of("\");
    string tem_path = src_path.substr(index);

    dst_path = dst_path + tem_path;

    rename(src_path.c_str(),dst_path.c_str());
    return true;

}

src_path 待移动文件夹

dst_path存放路径

Files是自己定义的一个类,可无视

原文地址:https://www.cnblogs.com/Daringoo/p/4496599.html