处理 cURL 中的空格
我正在尝试使用 cURL 将文件传输到 ftp 服务器,但我一直不知道如何处理目录名称中的空格。例如,我尝试以下代码:
C:\cURL\curl -T C:\Documents and Settings\outputfolder\temp1.txt ftp://ftpsite.com/ --user username:password
但它响应“curl: Can't open 'C:\Documents'!”我认为它有空格问题,所以我尝试用 %20: 替换它,
C:\cURL\curl -T C:\Documents%20and%20Settings\outputfolder\temp1.txt ftp://ftpsite.com/ --user username:password
但它随后响应“curl: Can't open 'C:\Documents%20and%20Settings\outputfolder\temp1.txt'!”
那么,当我尝试指定要传输的文件夹和文件时,如何处理空白字符呢?
I'm trying to use cURL to transfer files to an ftp server, but for the life of me I can't figure out how to deal with whitespaces in my directory names. For example, I try the following code:
C:\cURL\curl -T C:\Documents and Settings\outputfolder\temp1.txt ftp://ftpsite.com/ --user username:password
but it responds with "curl: Can't open 'C:\Documents'!" I figured it has any issue with the whitespace, so I tried replacing it with %20:
C:\cURL\curl -T C:\Documents%20and%20Settings\outputfolder\temp1.txt ftp://ftpsite.com/ --user username:password
but it then responds with 'curl: Can't open 'C:\Documents%20and%20Settings\outputfolder\temp1.txt'!'
So, how do I go about dealing with the whitespace characters when I'm trying to specify the folder and file that I want to transfer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
CMD.EXE
无法识别%20
。使用双引号代替:CMD.EXE
doesn't understand%20
. Use doublequotes instead:尝试将文件名用双引号引起来。
IE:
Try wrapping your filenames in double quotes.
I.e.:
尝试使用“\”或在目录名称两边加上引号。
Try '\ ' or putting quotes around the directory name.