Problem Escaping Spaces in File Name

Jon me at jonwatson.ca
Mon Jan 5 16:29:11 GMT 2009


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
> 
> 


More information about the rsync mailing list