[chronojump/michrolab] new CopyFilesRecursively for export (without the gui updates of backup)
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/michrolab] new CopyFilesRecursively for export (without the gui updates of backup)
- Date: Thu, 13 Oct 2022 13:09:22 +0000 (UTC)
commit fb21854af71dcb99f2bb42339eb1be6f6bbe8c7c
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]