QString path = "image_grab"; QDir dir(path); dir.removeRecursively(); if (!dir.exists()) { bool ismkdir = QDir().mkdir(path); if (!ismkdir) qDebug() << "Create path fail" << endl; else qDebug() << "Create fullpath success" << endl; } else { qDebug() << "fullpath exist" << endl; }