Search code examples
bashscriptingrsync

Bash scripting rsync: rsync: link_stat (blah) failed: No such file or directory (2)


I am trying to write a simple bash script for my local (Mac OS X) machine to move files from a directory on my machine to a remote machine. This line is failing:

rsync --verbose  --progress --stats --compress --rsh=ssh \
      --recursive --times --perms --links --delete \
      --exclude "*bak" --exclude "*~" \
      /repository/* $DEV_SERVER:$REMOTE_DIR

$DEV_SERVER and $REMOTE_DIR are defined previously, and I echo them to verify they're accurate.

The error I'm getting is:

rsync: link_stat /Users/myusername/mycurrentdirectory failed: No such file or directory (2)

To note here is that rather than using the defined directory (/repository, which is in the root of the machine), it uses my working directory. What is causing this?


Solution

  • Check that your \ characters have no whitespace after them at the end of the line. This will cause BASH to not interpret the line wrap correctly, giving the rsync error above.