Created
November 28, 2014 12:53
-
-
Save jarun/9296a03f6a747fc2e78d to your computer and use it in GitHub Desktop.
Backup modified files
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
$ cat list.txt | |
/home/arun/.bashrc | |
/home/arun/.vimrc | |
/home/arun/.config/smplayer/smplayer.ini | |
/opt/tor-browser_en-US/Docs/ChangeLog.txt | |
$ take_backup.sh list.txt | |
$ tar -xvf backup-timestamp.tar.bz2 -C / | |
------------------------------------------------- | |
#!/bin/bash | |
#file: take_backup.sh | |
lt_red='\e[1;31m' | |
BACKUP_DIR=backup-$(date "+%Y_%m_%d_%H_%M_%S") | |
mkdir $BACKUP_DIR | |
cat $1 | xargs cp --parents -t $BACKUP_DIR | |
cd $BACKUP_DIR | |
tar -jcvf ../$BACKUP_DIR.tar.bz2 * | |
cd .. | |
rm -rf $BACKUP_DIR | |
echo -e ${lt_red}Backed-up in $BACKUP_DIR.tar.bz2 | |
------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment