scp copies files to the server directory with a space path

Problem: Use the scp command to upload the file to the file path with spaces on the server

Try one: use the escape character "\"

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

[email protected]'s password: 

scp: ambiguous target

Attempt two: use two escape characters

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

Reports/organization/: No such file or directory

Solution: You need to add double quotes to the path and add two escape characters in the space

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    

Guess you like

Origin blog.csdn.net/wangpei930228/article/details/108496883