I trying to do a bash script that make a user messages backup, folder by folder (some folders has 1Gb).
But some message folders has space in name, like:

/pessoal/amigos/ana carolina

In prompt I use:

zmmailbox -z -m mone@dominio.com.br GRU "//?fmt=tgz& query=in:/pessoal/amigos/ana" %20"carolina" > teste.tgz

And works well. But in bash script doesn work:

pasta='/pessoal/amigos/ana carolina'
query=$(echo $pasta | sed -e 's/ /\" \%20\"/g')

zmmailbox -z -m mone@dominio.com.br GRU '//?fmt=tgz&query=in:'"$query" > teste.tgz

ERROR: service.FAILURE (system failure: GET from http://mercurio.dominio.com.br:81/ho...520%22carolina failed, status=500. system failure: tgz formatter failure)

I tried some different combinations and always the error is similar. When $query is passed to zmmailbox command, the " %20" become %22%20%2520%22

Somebody can help me?