I am trying to run the following rsync command from within a bash script on OSX
rsync -rav -e "ssh -i $KEYPAIR" --exclude ".git" --exclude '*.pyc' $SRC $DEST
The problem is I can't get rsync to use $SRC
as an absolute path. It always includes the relative dir from which I'm calling the bash script. Even if I prepend the path with ~/
. Is there anyway around this?
Seems like the value of $SRC
is not starting with /
, can you check this? If it does not start with /
(ie. mnt/drive/
), will be treated as a relative directory inside the current one. But if it starts with /
(ie. /mnt/drive
) it should work as you expect.