如何将 scp 与 xargs 一起使用? [英] How to use scp with xargs?

查看:104
本文介绍了如何将 scp 与 xargs 一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将非常大的文件从一台主机移动到另一台主机.此外,文件名太大,所以我必须使用 xargs.还需要复制所有子目录

I am trying to move very big file from one host to another host. Also the file names are too large so I have to use xargs. Also all the sub directories need to be copied also

我在源主机当前目录中使用以下命令

I am using the below command in the source host current directory

find . -name "*" -type f -print0 | xargs -0 scp -r UserName@host:/path/to/destination

但它抛出以下错误

scp: /path/to/destination: not a regular file

推荐答案

您需要使用 {} 将 src 文件名放在目的地之前.这是新命令:

you need to use {} to put the src filename before the destination. Here is the new command:

find . -name "*" -type f -print0 | xargs -0 -I {} scp -r {} UserName@host:/path/to/destination

这篇关于如何将 scp 与 xargs 一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆