scp复制文件到带空格路径的server目录

问题:使用scp命令将文件上传的服务器的带空格的文件路径下

尝试一:使用转义符"\"

wangpeipei@bogon organization % scp -P 22 ./dashboard.efw* [email protected]:/report/hi-repository/Sample\ Reports/organization/ 

[email protected]'s password: 

scp: ambiguous target

尝试二:使用两个转义符

wangpeipei@bogon organization % scp -P 22 ./dashboard.efw* [email protected]:/report/hi-repository/Sample\\ Reports/organization/ 

Reports/organization/: No such file or directory

解决方案:需要将路径加双引号并在空格处添加两个转义符

wangpeipei@bogon organization % scp -P 22 ./dashboard.efw* [email protected]:"/report/hi-repository/Sample\\ Reports/organization"

[email protected]'s password: 

dashboard.efwd                                100% 1312    94.1KB/s   00:00    

dashboard.efwvf                               100%  243    30.3KB/s   00:00    

猜你喜欢

转载自blog.csdn.net/wangpei930228/article/details/108496883