12 lines
230 B
Bash
12 lines
230 B
Bash
#!/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
|