scp 一次传递多个文件 - 到一台目标服务器上的多个目的地?

war*_*ren 9 file-management scp

我想将几个目录中的大约六个文件 scp 到目标机器上的相同目录。

不使用 ssh 密钥,这可以在一次通话中实现吗?

例如:

scp /path/to/fileA,/anoth/erpath/to/fileB,/yet/more/files/*    #continue next line
    destination:/path/to,/anoth/erpath/to,/yet/more/files
Run Code Online (Sandbox Code Playgroud)

Gil*_*il' 9

在发送端压缩文件并在接收端解压缩它们。

tar -cf - /path/to/fileA /anoth/erpath/to/fileB /yet/more/files/* |
ssh -C destination 'cd / && tar -xf -'
Run Code Online (Sandbox Code Playgroud)

您还可以编写 sftp 会话的脚本,或将 rsync 与正确的过滤器一起使用。