local backup_root="/images/backup"
local backup_name="sicherung"
+ [ -d "$backup_root" ] \
+ || errlog "could not find directory $backup_root" \
+ || return $?
+
local remote_user=${machine%%@*}
local remote_machine=${machine%:*}
local remote_machine=${remote_machine#*@}
local remote_port=${machine##*:}
local backup_dir="$date"_"$number"_"$backup_name"
+ [ -d "$backup_root/$backup_dir" ] \
+ || errlog "could not find directory $backup_root/$backup_dir" \
+ || return $?
+
+ [ -d "$backup_root/$backup_dir/$remote_machine" ] \
+ || errlog "could not find directory $backup_root/$backup_dir/$remote_machine" \
+ || return $?
+
local restore_path="$backup_root/$backup_dir/$remote_machine$path"
local remote_path="$remote_user@$remote_machine:$path"
local mode="directory"
-
[[ "$path" =~ /$ ]] || mode="file"
+ [ -f "$restore_path" ] || [ -d "$restore_path" ] \
+ || errlog "could not find $restore_path" \
+ || return $?
+
echo "ℹ️ INFO: restore mode $mode"
echo