summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorself <george@gabbott.dev>2022-10-19 16:11:16 +0100
committerself <george@gabbott.dev>2022-10-19 16:11:16 +0100
commit1500875416689d6255035182259a95d172bde4de (patch)
treea483f19638fa91065650180c2d942829b8c0ada2
parentbe9e37d828f171de2d381711d371d46153c707d1 (diff)
Added command to backup a directory
-rw-r--r--scripts/backup-directory11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/backup-directory b/scripts/backup-directory
new file mode 100644
index 0000000..2b754f0
--- /dev/null
+++ b/scripts/backup-directory
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Backup a directory using GPG.
+# Usage: backup-directory directory-name
+
+DIRECTORY="$1"
+
+7z a "$DIRECTORY.7z" "$DIRECTORY"
+gpg --encrypt --armor --symmetric --output "$DIRECTORY.7z.asc" "$DIRECTORY.7z"
+sha256sum "$DIRECTORY.7z.asc" | cut -c1-64 > "$DIRECTORY.asc.sum"
+