add bak function

This commit is contained in:
Daylin Morgan 2023-04-04 13:43:08 -05:00
parent 3f87b59daf
commit 102e770853
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -0,0 +1,12 @@
#!/usr/bin/env zsh
##? append date/time and `.bak` to file
local now f
now=$(date +"%Y%m%d-%H%M%S")
for f in "$@"; do
if [[ ! -e "$f" ]]; then
echo "file not found: $f" >&2
continue
fi
cp -R "$f" "$f".$now.bak
done