Skip to content

Instantly share code, notes, and snippets.

@addame
Created February 29, 2012 16:25
Show Gist options
  • Save addame/1942221 to your computer and use it in GitHub Desktop.
Save addame/1942221 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script may be used to backup files having a specific extension
source="/path/to/source/dir"
dest="/path/to/rep/backup"
day=$(date +%d-%m-%Y)
# backup img files
shopt -s nullglob
for f in *.img
do
file_dest="$f-$day.tar.gz"
echo "- Backing up $file_dest -----------------"
tar czf $dest/$file_dest $source/$f
echo " ----- end ----------------------"
done
echo
echo "Backup finished"
echo
ls -lh $dest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment