You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/roles/common/files/backup_rename.sh

11 lines
174 B
Bash

#!/usr/bin/env bash
set -euxo pipefail;
dir="$(dirname "$1")";
date="$(date +%Y-%m-%d-%H-%M)";
name="$(basename "$1")";
ext="${name##latest.}";
mv "$1" "$dir/$date.$ext";