Skip to content

Instantly share code, notes, and snippets.

@NiklasMM
Last active December 26, 2015 07:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NiklasMM/7115336 to your computer and use it in GitHub Desktop.
Save NiklasMM/7115336 to your computer and use it in GitHub Desktop.
One line file backup script
#!/bin/bash
SOURCE_DIR=/home/niklas/
TARGET_DIR=/media/Backup/FileBackup
EXCLUDE_FILE=/home/niklas/rsync_excludelist
rsync -avP --exclude-from=${EXCLUDE_FILE} --delete-excluded --delete --stats ${SOURCE_DIR} ${TARGET_DIR}
# add log entry to target dir
LOGFILE="$TARGET_DIR/backup_log"
DATE=$(date)
echo "Last backup on $DATE" >> $LOGFILE
@NiklasMM
Copy link
Author

Obviously you have to adjust the paths...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment