Skip to content

Instantly share code, notes, and snippets.

@marek-saji
Last active December 26, 2015 01:19
Show Gist options
  • Select an option

  • Save marek-saji/7070220 to your computer and use it in GitHub Desktop.

Select an option

Save marek-saji/7070220 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Backup files specified in ~saji/.config/backup-these
# (c) Marek `saji' Augustynowicz
if [ "$EUID" != "0" ]
then
echo "Run as root, yo."
exit 1
fi
DIR="$( dirname "$0" )/$HOSTNAME"
mkdir -p "$DIR"
cd "$DIR"
pwd
# -R use relative path names (will create whole path under current dir,
# not just use dirname)
# -a archive mode
# -p preserve permissions
# -v verbose
# -u update: copy only never files
# --progress display progress
cat ~saji/.config/backup-these | xargs -I '{}' \
rsync -Rapvu --progress '{}' ./
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment