Created
August 15, 2013 07:38
-
-
Save codeachange/6238964 to your computer and use it in GitHub Desktop.
shell script to backup a directory
This file contains hidden or 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 file must be put in the same directory of TargetDir | |
# Because using relative path to avoid tar warning: | |
# tar: Removing leading `/' from member names | |
TargetDir="html" | |
DestDir="/var/www/backup/dir" | |
NOW="$(date +"%Y-%m-%d")" | |
tar -czf "$DestDir/html.$NOW.tar.gz" "$TargetDir" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment