Qt

Qtコピーファイル、フォルダー(QFile ::コピー)



Qt Copy Files Folders Qfile



// copy files: bool MyTest007::copyFileToPath(QString sourceDir ,QString toDir, bool coverFileIfExist) { toDir.replace('\','/') if (sourceDir == toDir){ return true } if (!QFile::exists(sourceDir)){ return false } QDir *createfile = new QDir bool exist = createfile->exists(toDir) if (exist){ if(coverFileIfExist){ createfile->remove(toDir) } }//end if if(!QFile::copy(sourceDir, toDir)) { return false } return true } // copy the folder: bool MyTest007::copyDirectoryFiles(const QString &fromDir, const QString &toDir, bool coverFileIfExist) { QDir sourceDir(fromDir) QDir targetDir(toDir) if (! targetDir.exists ()) {/ **