Last active
June 21, 2017 15:20
-
-
Save ijin82/598f4ecf1a30dd48d14d8b4141dfc11b to your computer and use it in GitHub Desktop.
backup-folders-list.sh
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 | |
## config | |
backupFoldersList=" | |
/home/user/projects/project-name | |
" | |
backupDstFolder="/home/user/projects-dump" | |
## /config | |
targetFolder="dump-$(date +%Y-%m-%d_%H%M%S)" | |
backupFolder="$backupDstFolder/$targetFolder/" | |
echo " | |
-------------------------------------------------- | |
simple backup | |
now: "`date`" | |
i'll save dump to: "$backupFolder" | |
-------------------------------------------------- | |
" | |
# create dir for current dump | |
mkdir -p $backupFolder | |
echo "dumping folders: | |
-------------------------------------------------- | |
" | |
# pack all src dirs | |
for folder in $backupFoldersList; do | |
dstFile=$backupFolder`basename $folder`".tar.gz" | |
echo $folder" -> "$dstFile | |
tar -czf $dstFile -C $folder ./ &> /dev/null # no output from tar | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment