42 const QString &tgtFilePath)
44 QFileInfo srcFileInfo(srcFilePath);
45 if (srcFileInfo.isDir())
47 QDir targetDir(tgtFilePath);
48 if (!targetDir.mkpath(
"."))
53 QDir sourceDir(srcFilePath);
54 QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
55 foreach (
const QString &fileName, fileNames)
57 const QString newSrcFilePath = srcFilePath + QLatin1Char(
'/') + fileName;
58 const QString newTgtFilePath = tgtFilePath + QLatin1Char(
'/') + fileName;
64 if (!QFile::copy(srcFilePath, tgtFilePath))
75 if (dir.exists(dirName)) {
76 Q_FOREACH(QFileInfo info, dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) {
81 result = QFile::remove(info.absoluteFilePath());
88 result = dir.rmdir(dirName);
96 dir.setFilter(QDir::AllDirs|QDir::NoDotAndDotDot);
97 QFileInfoList retval = dir.entryInfoList();
105 dir.setFilter(QDir::Files);
106 dir.setNameFilters(nameFilters);
108 foreach(QFileInfo file, dir.entryInfoList())
109 retval << file.absoluteFilePath();
112 foreach(QFileInfo directory,
getDirs(path))
bool copyRecursively(const QString &srcFilePath, const QString &tgtFilePath)
bool removeNonemptyDirRecursively(const QString &dirName)
QFileInfoList getDirs(QString path)
QStringList getAbsolutePathToXmlFiles(QString path, bool includeSubDirs)
QStringList getAbsolutePathToFiles(QString path, QStringList nameFilters, bool includeSubDirs)