Thursday, 30 May 2013

bash script to timestamp snapshot backups of directory

modified a script from

to be a simplified snapshot copy of the FOLDER and append the date to the folder name. Useful to have an backup on Dropbox since some files might go missing suddenly on shared folders.

#sh FOLDER [go]
# 'go' will execute
path=Snaphotbackup-`date +%m-%b-%y`
# Run with "go" as the second CLI parameter to actually run the rsync command, otherwise prints the command that would have been run (useful for testing)
if [[ "$2" == "go" ]]
        rsync -avP --delete $1 $1-$path
        echo rsync -avP --delete $1 $1-$path

No comments:

Post a Comment

Datanami, Woe be me