QString oldexepath=QCoreApplication::applicationDirPath()+QDir::separator()+"your_folder"
if (!dir.exists())
{
dir.mkpath(oldexepath);
}
QStringList list;
QDirIterator it(oldexepath, QStringList() << "*.*", QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
while(it.hasNext()) {
it.next();
list.append(it.fileInfo().absoluteFilePath());
}
foreach(QString str, list) {
QFile::remove(str);
}
QT删除某个文件夹下的所以文件
于 2023-09-27 16:26:00 首次发布