[chronojump] new CopyFilesRecursively for export (without the gui updates of backup)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] new CopyFilesRecursively for export (without the gui updates of backup)
- Date: Mon, 10 Oct 2022 09:38:13 +0000 (UTC)
commit 50f6b3e517a08db331ee012154d018d951bbda83
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Oct 10 11:32:27 2022 +0200
new CopyFilesRecursively for export (without the gui updates of backup)
src/util.cs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/src/util.cs b/src/util.cs
index 495ec27d2..56517ca27 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -2565,8 +2565,27 @@ public class Util
LogB.Error("Couldn't Insert text at the beginning of File");
}
}
+
+ //used on export where we just want to copy the dirs without updating gui objects
+ //https://stackoverflow.com/a/3822913
+ public static void CopyFilesRecursively(string sourcePath, string targetPath)
+ {
+ //Now Create all of the directories
+ foreach (string dirPath in Directory.GetDirectories(sourcePath, "*",
SearchOption.AllDirectories))
+ {
+ Directory.CreateDirectory(dirPath.Replace(sourcePath, targetPath));
+ }
+
+ //Copy all the files & Replaces any files with the same name
+ foreach (string newPath in Directory.GetFiles(sourcePath, "*.*",SearchOption.AllDirectories))
+ {
+ File.Copy(newPath, newPath.Replace(sourcePath, targetPath), true);
+ }
+ }
+
}
+//used on backup
public class UtilCopy
{
public int BackupMainDirsCount;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]