can somone tell me how i get this line to work?

rsync -rtvz --delete --exclude-from exclude.txt --out-format="%M %o %n" -e "ssh -p 2323 -i /root/.ssh/server" Administrator@someserver.dynv6.net:'/cygdrive/C/Nas/Public/Büro/Kunde/Anfrage Eingang (AFE)/ '/volume2/Nas/Public/Büro/Kunde/Anfrage Eingang (AFE)/'

I got this error message -ash: syntax error near unexpected token `('

It is a synology DSM 6.x


Administrator@someserver.dynv6.net:'/cygdrive/C/Nas/Public/Büro/Kunde/Anfrage Eingang (AFE)/' '/volume2

looks like you're missing a closing tick ' between (AFE)/ and /volume2

Also you may need to escape the parentheses \( \)

  • hmm Thanks now i got this receiving incremental file list rsync: link_stat "/cygdrive/C/Nas/Public/Büro/Kunde/Anfrage" failed: No such file or directory (2) rsync: link_stat "/Users/Administrator.SERVER/Eingang" failed: No such file or directory (2) rsync: link_stat "/Users/Administrator.SERVER/(AFE)" failed: No such file or directory (2) sent 220 bytes received 10 bytes 153.33 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1898) [Receiver=3.0.9] – Ronny Jul 28 '17 at 16:33
  • Check the file paths to make sure they are correct. It's saying /cygdrive/etc doesn't exist. – Benny Jul 28 '17 at 16:56
  • If i do rsync -rtvz --delete --exclude-from exclude.txt --out-format="%M %o %n" -e "ssh -p 2323 -i /root/.ssh/server" Administrator@someserver.dynv6.net:'/cygdrive/C/Nas/Public/Büro/Kunde/' '/volume2/Nas/Public/Büro/Kunde/' its working and also syncronise a folder called "Anfrage Eingang (AFE)" receiving incremental file list 2017/06/13-08:29:30 recv Anfrage Eingang (AFE)/ 2017/04/12-09:19:00 recv Anfrage Eingang (AFE)/Müllabwurf.PDF – Ronny Jul 28 '17 at 17:10
  • Ah, try escaping the space in 'Anfrage Eingang' >'Anfrage\ Eingang\ (AFE)' – Benny Jul 28 '17 at 17:13
  • I did, its same result – Ronny Jul 28 '17 at 17:14

This one did the Job :-)

If you need to transfer a filename that contains whitespace, you can either specify the --protect-args (-s) option, or you'll need to escape the whitespace in a way that the remote shell will understand. For instance:

So the final answer is if you want to avoid errors with spaces and brackets on local copy just use double quotes for vars like:

source="/root/new folder ()/"
dest="/root/some other folder ()"
rsync -rtvz --delte "$source" "$dest"

If you want to copy from a remote host then the --protect-args flag has to be set.

rsync -rtvz --delete --protect-args -e "ssh -p 22 -i /root/.ssh/somekey" root@someserver:"$source" "$dest"


rsync -rtvzs --delete -e "ssh -p 22 -i /root/.ssh/somekey" root@someserver:"$source" "$dest"
  • 1
    Your answer seems incomplete. Please only post an answer if it really solved your own problem, and include all the necessary commands. – slhck Jul 28 '17 at 21:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.