将文件从远程计算机复制到远程计算机上的文件夹

将文件从远程计算机复制到远程计算机上的文件夹

当我们将文件从远程文件夹复制到另一个远程文件夹时,为什么会出现以下错误:“没有这样的文件或目录”?

 ssh -n -o  ConnectTimeout=50 -o StrictHostKeyChecking=no -xaq  $IP "cp -rp /opt/dir  /tmp"


 cp: cannot stat ‘/opt/dir/edits_inprogress_0000000001294909743’: No such file or directory

...或者也许有更好的方法?

我们也尝试

 find  /opt/dir  -print0 | rsync -0a --files-from=- --ignore-missing-args /opt/dir /tmp/
rsync: --ignore-missing-args: unknown option
rsync error: syntax or usage error (code 1) at main.c(1435) [client=3.0.9]



rsync --version
rsync  version 3.0.9  protocol version 30
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

答案1

您可以尝试使用 rsync 命令来实现此目的

对于本地主机同步,您可以使用以下命令

rsync -avzh /home/praveen/10 /var/tmp/

用于与远程机器同步

rsync -avzh remotemachineip:/remotemachineath localserverdestinationfolder

相关内容