Created
February 29, 2012 16:25
-
-
Save addame/1942221 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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