From 190a0d0a8b397f095a07d5b8e28446230aba0d62 Mon Sep 17 00:00:00 2001 From: Meleki Date: Sun, 1 Mar 2026 21:45:37 +0100 Subject: [PATCH] =?UTF-8?q?Backup:=20tar.gz=20ohne=20./Root-Ordner=20?= =?UTF-8?q?=E2=80=93=20Eintr=C3=A4ge=20direkt=20auf=20oberster=20Ebene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Endpoints/BackupEndpoint.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Endpoints/BackupEndpoint.cs b/Endpoints/BackupEndpoint.cs index f5b8f15..dd257e4 100644 --- a/Endpoints/BackupEndpoint.cs +++ b/Endpoints/BackupEndpoint.cs @@ -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)) {