commit 9c55f36849b578e8163568365966d4f4a2508b88
parent e776d1fb25616fce4f1ce48962d88d3c4045b1ed
Author: breadcat <breadcat@users.noreply.github.com>
Date: Mon, 26 Jan 2026 14:52:54 +0000
Exclude certain file extensions from backups
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/scripts/restic.nix b/scripts/restic.nix
@@ -4,13 +4,18 @@ let
backup-cloud = pkgs.writeShellScriptBin "backup-cloud" ''
# variables
directories=( "$HOME/docker/" "$HOME/vault/" )
+ excludes=( "*.jpg" "*.jpeg" "*.mp4" "*.webm" "*.mkv" )
+ exclude_args=()
+ for ext in "''${excludes[@]}"; do
+ exclude_args+=("--exclude=$ext")
+ done
# process
source "$HOME/vault/docs/secure/restic.env"
# Directory loop
for dir in "''${directories[@]}"; do
if [[ -d "$dir" ]]; then
echo "Directory exists: $dir"
- ${pkgs.restic}/bin/restic backup "$dir"
+ ${pkgs.restic}/bin/restic backup "$dir" "''${exclude_args[@]}"
else
echo "Directory does not exist: $dir"
fi