Skip to content

Instantly share code, notes, and snippets.

@sr-rolando
Last active January 4, 2016 10:08
Show Gist options
  • Save sr-rolando/8606350 to your computer and use it in GitHub Desktop.
Save sr-rolando/8606350 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Ablegen in: ~/s/run_my_backup.sh
# Aufrufen mittels:
# 1. Terminal.app öffnen
# 2. ./s/run_my_backup.sh [Enter]
# Voraussetzung: Das Backup-Verzeichnis (s. DEST_DIR) existiert.
HOME_DIR=/Users/mystrantus
DEST_DIR=/Volumes/myfancynas/mybackupdir
MKDIR_CMD=/bin/mkdir
RSYNC_CMD=/usr/bin/rsync
RSYNC_OPTS="-r --delete"
cd $HOME_DIR
for cur_dir in Desktop Documents Library Movies Music Pictures Public s
do
echo "Starte: $cur_dir"
if [ ! -d $DEST_DIR/$cur_dir ]
then
$MKDIR_CMD $DEST_DIR/$cur_dir
fi
$RSYNC_CMD $RSYNC_OPTS $cur_dir $DEST_DIR
echo "... $cur_dir: erledigt."
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment