Problem Escaping Spaces in File Name
Jon
me at jonwatson.ca
Mon Jan 5 18:06:23 GMT 2009
Hi,
Mike Bombich wrote:
> Take a look at the "--protect-args" argument as well, this is probably a
> more elegant solution.
Thanks, I agree it would be. Both these systems are running 2.6.8,
though, which was released prior to the --protect-args switch.
Add another thing to my list...
Thanks
Jon
>
> -s, --protect-args
> This option sends all filenames and some 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 use this option with --iconv, the args will also be
> translated from the local to the remote character-set. The
> translation happens before wild-cards are expanded. See
> also the --files-from option.
>
>
> Mike
>
> On Jan 5, 2009, at 10:29 AM, Jon wrote:
>
>> As is always the case, I seem to have solved it a few minutes after
>> writing this email.
>>
>> Turns out I don't need to escape it at all if I wrap the entire source
>> path in double quotes. I had tried only wrapping the final directory
>> in double quotes and that was failing.
>>
>> Thanks
>>
>> Jon
>>
>> Jon wrote:
>>> Hi All,
>>> I realize this has been addressed ad naseum, but I simply cannot seem
>>> to solve my issue despite many hours of mucking about. I am
>>> attempting to run a command like:
>>> rsync -prvl --delete --stats --progress -e 'ssh -p 22 -i
>>> /root/.ssh/id_dsa'
>>> backup/company/data/current_backup/company_Ralf/doc\\\ -\\\ network/
>>> root at server.domain.com:"/drives/m/mirrorcentralstoredir/company/'doc
>>> - network/'" > '/backup/company/logs/Sync_company_doc -
>>> network_temporary_log_file.log'
>>> I am getting the error:
>>> rsync: link_stat
>>> "/backup/company/data/current_backup/company_Ralf/doc\ -\ network/."
>>> failed: No such file or directory (2)
>>> That particular call is escaped three times as per one of the
>>> examples on [1], but I have tried one and two escapes as well.
>>> I have attempted all manners of escaping listed on the Rsync site
>>> [1], but to no avail. I suspect that is because I am using rsync
>>> through SSH and those examples deal with connecting to the rsync
>>> daemon on the remote system.
>>> I have tried wrapping the source path in single quotes and double
>>> quotes (and the single then double quote as listed in [1]) as well
>>> as escaping the space with a varying number of backslashes and I
>>> always get the same error.
>>> I have verified that the source directory does indeed exist.
>>> I am not an expert is escaping, but I believe the command is escaped
>>> twice. Once in the script that makes the call, once on the host OS
>>> when the rsync call is made.
>>> Can someone save me from my madness and point out what I am not seeing?
>>> Thanks
>>> Jon
>>> [1]. http://samba.anu.edu.au/rsync/FAQ.html#9
>> --
>> 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
>
More information about the rsync
mailing list