From 27021d447e0d284f18d4090f3722fa9d47e7a85e Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Tue, 17 Sep 2024 18:08:30 +0200 Subject: [PATCH] Utility to clear folder recursively --- Classes/Swift/FileUtil.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Classes/Swift/FileUtil.swift b/Classes/Swift/FileUtil.swift index 08a80e826..9f8321258 100644 --- a/Classes/Swift/FileUtil.swift +++ b/Classes/Swift/FileUtil.swift @@ -136,4 +136,14 @@ import linphonesw } } + @objc public class func deleteRecurse(appGroupName:String) { + let fileManager = FileManager.default + do { + let fileURLs = try fileManager.contentsOfDirectory(at: FileUtil.sharedContainerUrl(appGroupName: appGroupName), includingPropertiesForKeys: nil) + fileURLs.forEach{delete(path: $0.absoluteURL.path)} + } catch { + Log.e("Error while enumerating files \(error.localizedDescription)") + } + } + }