簡體   English   中英

使用scp在文件名中帶有空格的Copyinf文件

[英]Copyinf files with spaces in the file name using scp

我正在嘗試通過shell腳本使用scp復制文件。 我的代碼是:

for file in $result;
do
scp username@hostname:"$feed" destination
done

結果中包含要復制的文件列表。 但是它不會復制名稱中帶有空格的文件,例如:

new assignment.xls

請提供一個建議。

for file in $result;
do
name=`echo $file | sed 's/ /\\ //'`
scp username@hostname:"$name" destination
done
echo "${result}" | while read FileName
 do
   scp "user@hostname:${FileName}" destination
 done

(適用於while read而不是for in }中for in

封裝整個源,而不僅僅是文件/路徑。 destionation可能還需要一個報價是空間或其它字符元里面

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM