dotfiles/home/private_dot_config/zsh/functions/executable_bak

13 lines
230 B
Text
Raw Permalink Normal View History

2023-04-04 13:43:08 -05:00
#!/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