2011-03-28 70 views
1

我正在嘗試使用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 '!'

那麼,當我試圖指定要傳輸的文件夾和文件時,如何處理空白字符?

回答

1

嘗試用雙引號包裝文件名。

即:

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

1

嘗試 '\' 或將周圍的目錄名引號。

2

CMD.EXE不明白%20。改爲使用雙引號:

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