I cant get my rsync script to work if source or destination variable have a space in the folder name
#!/bin/bash
HOST="[email protected]"
source="/path/My Files/"
dest="/path/My Files2/"
rsync -avhP --delete "$HOST":"$source" "$dest"
the error i get is
receiving incremental file list
rsync: [sender] link_stat "/path/My" failed: No such file or directory (2)
rsync: [sender] change_dir "/root/Files" failed: No such file or directory (2)
Any help how to write this would be great
Add option -s with current rsync version.
From man rsync:
-s, --protect-args: This option sends all filenames and most options to the remote rsync without allowing the remote shell to interpret them. This means that spaces are not split in names, and any non-wildcard special characters are not translated (such as ~, $, ;, &, etc.). Wildcards are expanded on the remote host by rsync (instead of the shell doing it).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With