1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "qfileutil_p.h"
5#include <QtCore/qfile.h>
6#include <QtCore/qdiriterator.h>
7#include <QtCore/qfileinfo.h>
8#include <QtCore/qstring.h>
9
10QT_BEGIN_NAMESPACE
11
12bool copyAllFiles(const QDir &source, const QDir &dest)
13{
14 using namespace Qt::Literals;
15
16 if (!source.exists() || !dest.exists())
17 return false;
18
19 QDirIterator it(source);
20 while (it.hasNext()) {
21 QFileInfo file{ it.next() };
22 if (file.isFile()) {
23 const QString destination = dest.absolutePath() + u"/"_s + file.fileName();
24 QFile::copy(fileName: file.absoluteFilePath(), newName: destination);
25 }
26 }
27
28 return true;
29}
30
31QT_END_NAMESPACE
32

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtmultimedia/src/multimediatestlib/qfileutil.cpp