Backup: tar.gz ohne ./Root-Ordner – Einträge direkt auf oberster Ebene

This commit is contained in:
Meleki committed 2026-03-01 21:45:37 +01:00
1 parent 71bb97be13
commit 190a0d0a8b
1 file changed
+12 -1
+12 -1
View File
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
@@ -28,13 +29,23 @@ public static class BackupEndpoint
var archiveName = $"gott-{timestamp}.tar.gz";
var archivePath = Path.Combine(backupDir, archiveName);
var entries = Directory.GetFileSystemEntries(dataDir)
.Select(e => Path.GetFileName(e))
.Where(e => e != "backup")
.ToArray();
var psi = new ProcessStartInfo
{
FileName = "tar",
ArgumentList = { "-czf", archivePath, "--exclude=backup", "-C", dataDir, "." },
RedirectStandardError = true,
UseShellExecute = false
};
psi.ArgumentList.Add("-czf");
psi.ArgumentList.Add(archivePath);
psi.ArgumentList.Add("-C");
psi.ArgumentList.Add(dataDir);
foreach (var entry in entries)
psi.ArgumentList.Add(entry);
using (var process = Process.Start(psi))
{