您好我正在尝试遍历目录并删除扩展名为“~”的文件这是我的代码
QString path = "/home/brett/sweetback";
QDirIterator it(path, QDirIterator::Subdirectories);
while (it.hasNext()) {
//ui.textEdit->append(QString(it.next()));
QFileInfo Info(it.next());
//ui.textEdit->append(QString(Info.fileName()));
QString testName = QString(Info.fileName());
QString subString = testName.right(1);
if(subString == QString("~")){
//wnat to remove file here
ui.textEdit->append(QString(subString));
remove(QString( testName));
}
}
我可以很好地列出文件,但不知道如何删除它们