Created
August 22, 2016 16:06
-
-
Save samdbmg/b22d9f0b348461517a7df5fd331e819c to your computer and use it in GitHub Desktop.
Rsync a folder to two drives at the same time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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