处理cURL中的空白问题

问题描述:

我正在尝试使用cURL将文件传输到ftp服务器,但对于我的生活,我无法弄清楚如何处理我的目录名称中的空格。例如,我尝试下面的代码:处理cURL中的空白问题

C:\cURL\curl -T C:\Documents and Settings\outputfolder\temp1.txt ftp://ftpsite.com/ --user username:password 

但响应“卷曲:无法打开‘C:\文件’!”我想这与空白的任何问题,所以我试着用20%替换它:

C:\cURL\curl -T C:\Documents%20and%20Settings\outputfolder\temp1.txt ftp://ftpsite.com/ --user username:password 

但随后响应是“卷曲:无法打开” C:\文件%20于是%20Settings \ outputfolder \ temp1.txt '!'

那么,当我试图指定要传输的文件夹和文件时,如何处理空白字符?

尝试用双引号包装文件名。

即:

C:\cURL\curl -T "C:\Documents and Settings\outputfolder\temp1.txt" ftp://ftpsite.com/ --user username:password 
+0

谢谢大家,这似乎是伎俩!虽然现在它说它没有上传文件(错误552?),但这是一个单独的问题。 – Josiah 2011-03-28 20:22:19

尝试 '\' 或将周围的目录名引号。

CMD.EXE不明白%20。改为使用双引号:

C:\cURL\curl -T "C:\Documents and Settings\outputfolder\temp1.txt" ftp://ftpsite.com/ --user username:password