I haven't used rsync with networks, but I do use bash a lot.
First, let me state the obvious. It looks like your code is executing
rsync in a bash one liner once for each file that find returns. That's
not cool! And it's almost definitely not what you wanted to do.
Among other things, that means that bash is seeing all those embedded
blanks and the parentheses in your file names and getting upset because
blanks delimit arguments and parentheses are used for a number of
syntactically meaningful things.
So, at a minimum, you need to escape/quote *both* of your file
references {} - not just the one.
But the real issue is that you should probably let find put all the
resulting file names into a file or pipe and send that to rsync once
using something like
--files-from=FILE read list of source-file names from FILE
where you should be able to use "-" as the file name so it uses the
output of the find command as input to rsync.
Once you get that sorted, any remaining errors should be a lot easier to
fix.
Joe
On 08/17/2015 02:13 AM, @lbutlr wrote:
I was trying to process a bunch of folders to sync them to another drive and
ran across an error I haven’t seen before. Normally I do this sync via a
mounted file system, but this time I tried to do it over ssh:
find . -type f -atime -1 -exec rsync -aP {} 10.0.0.11:/Volumes/Drive5/{} \;
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `rsync --server -logDtpre.iLsfx --log-format=X --partial .
/Volumes/Drive5/./Taxes (2012)/W2 (2012).pdf'
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226)
[sender=3.1.1]
If I mount Drive5 and run the same command, it works fine.
Put "/Volumes/Drive5/{}” in quotes doesn’t help.
Ideas?
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html