Skip to content

Instantly share code, notes, and snippets.

@samdbmg
Created August 22, 2016 16:06
Show Gist options
  • Save samdbmg/b22d9f0b348461517a7df5fd331e819c to your computer and use it in GitHub Desktop.
Save samdbmg/b22d9f0b348461517a7df5fd331e819c to your computer and use it in GitHub Desktop.
Rsync a folder to two drives at the same time
#!/bin/bash
if [ $# -lt 4 ];
then
echo "Usage: camera-disk-rsync.sh DESTINATIONFOLDER MOUNT1 MOUNT2 SOURCEFILE\r\n"
echo "Where MOUNT1 and MOUNT2 are the mountpoints of the two drives"
exit
fi
foldername=$1
mount1=$2
mount2=$3
shift
shift
shift
mkdir -p $mount1/$foldername
mkdir -p $mount2/$foldername
rsync -av --prune-empty-dirs "$@" $mount1/$foldername &
rsync -av --progress --prune-empty-dirs "$@" $mount2/$foldername
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment