删除无特殊字符文件名的文件
std::string del_path = this->traindata_temp_path + "/" + model_name + "/" + "123.csv";
std::string del_command = "rm " + del_train_path;
std::system(del_command.c_str());
删除含有特殊字符文件名的文件
std::string path= "/home/zhuwei/contour/linearIteration.shp";
int result = remove(path);
if(result==0)
{
cout<<"删除成功"<<endl;
}
else
{
cout<<"删除失败"<<endl;
}
ubuntu删除含有特殊字符的命令行
1.使用 ls -i 查处该文件的 inode 号,假设为9876
2. 使用find命令删除
find ./ -inum 9876 -exec rm '{}' \
或者:
sudo find ./* -inum 9876 -delete
注意:rm -rf可以用,但是作死,基本不会用,具体原因百度去吧。。。。。