summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/base/utils.cpp')
-rw-r--r--rbutil/rbutilqt/base/utils.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index 3ab8aa6906..f2d3f04887 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -1046,3 +1046,17 @@ bool Utils::ejectDevice(QString device)
return false;
}
+
+qint64 Utils::recursiveFolderSize(QString path)
+{
+ qint64 size = 0;
+ QList<QFileInfo> items = QDir(path).entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
+ for (auto item: items) {
+ size += item.size();
+ }
+ QList<QString> folders = QDir(path).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
+ for (auto folder: folders) {
+ size += recursiveFolderSize(path + "/" + folder);
+ }
+ return size;
+}