From 59b28fe62c746af0615a59e6e20ab7fd4154f74d Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 13 Mar 2025 14:09:02 -0400 Subject: [PATCH] check for empty backup dir --- kaya | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kaya b/kaya index 1b67a58..472b9f1 100755 --- a/kaya +++ b/kaya @@ -23,6 +23,7 @@ shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4 set -eE -o pipefail trap 'echo "kaya: backup failed" >&2' ERR +shopt -s dotglob nullglob kaya_protocol_version=2 @@ -196,6 +197,11 @@ main() { if [[ ! -d $backup_dir ]]; then create-backup-dir + else + backup_dir_files=( $backup_dir/* ) + if (( ${#backup_dir_files[@]} == 0 )); then + create-backup-dir + fi fi if [[ ! -e $password_file ]]; then -- 2.25.1