Skip to content

Instantly share code, notes, and snippets.

@mogya
Created January 6, 2012 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mogya/1570797 to your computer and use it in GitHub Desktop.
Save mogya/1570797 to your computer and use it in GitHub Desktop.
bk - create backup file with current date.
#!/bin/sh
#create backup file with current date,like hoge.20120106_231651
#file backup command
if [ $# -lt 1 ]
then
echo "usage: bk files.."
echo "create backup files with date string."
exit 0;
fi
EXT=`date +%Y%m%d.%H%M`
for FILE in $*
do
# echo "cp ${FILE} ${FILE}.${EXT}"
cp -a ${FILE} ${FILE}.${EXT}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment