我尝试将文件夹从我的 Linux 机器递归复制到远程机器,但没有成功。我尝试使用 scp 和 rsync,但两种情况下都没有复制任何文件,尽管我收到了确认消息。这是我的日志:
aleks@ThinkPad-T530:/opt/homeToDeal/werbung/column$ scp -rp /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/werbung
Warning: the ECDSA host key for 'heimdi.at' differs from the key for the IP address '185.101.157.64'
Offending key for IP in /home/aleks/.ssh/known_hosts:2
Matching host key in /home/aleks/.ssh/known_hosts:5
Are you sure you want to continue connecting (yes/no)? yes
[email protected]'s password:
ue_hor.png 100% 639KB 110.7KB/s 00:05
striche_hor.png 100% 730KB 110.8KB/s 00:06
striche_vert.png 100% 346KB 119.7KB/s 00:02
ue_vert.png 100% 435KB 119.0KB/s 00:03
但是当我登录到远程机器时我得到:
administrator@14980:/opt/homeToDeal/werbung/row$ ls
administrator@14980:/opt/homeToDeal/werbung/row$ cd ..
administrator@14980:/opt/homeToDeal/werbung$ cd column
administrator@14980:/opt/homeToDeal/werbung/column$ ls
administrator@14980:/opt/homeToDeal/werbung/column$
当我尝试使用 rsync 时,我得到了:
aleks@ThinkPad-T530:/opt/homeToDeal$ rsync -avz -e 'ssh' /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/werbung
Warning: the ECDSA host key for 'heimdi.at' differs from the key for the IP address '185.101.157.64'
Offending key for IP in /home/aleks/.ssh/known_hosts:2
Matching host key in /home/aleks/.ssh/known_hosts:5
Are you sure you want to continue connecting (yes/no)? yes
[email protected]'s password:
sending incremental file list
werbung/
werbung/column/
werbung/column/striche_vert.png
werbung/column/ue_vert.png
werbung/row/
werbung/row/striche_hor.png
werbung/row/ue_hor.png
但同样,没有文件被复制。
答案1
正如@DougSmythies 在他的评论中所说的那样:
“我怀疑文件确实被复制了,你只需要找到它们。查看 /opt/homeToDeal/werbung/werbung。”
是的,事实确实如此。因此,下次我递归复制文件夹时,应确保目标文件夹不包含路径中的最后一个源文件夹,即
代替
scp -rp /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/werbung
我将
scp -rp /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/
或者分别代替
rsync -avz -e 'ssh' /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal/werbung
我将
rsync -avz -e 'ssh' /opt/homeToDeal/werbung [email protected]:/opt/homeToDeal