如何获取SCP复制的总字节数

如何获取SCP复制的总字节数

我想知道使用以下方法从两个不同位置复制到另一台服务器的数据的总大小scp

scp  /../folder1  /../folder2 srv2:/output/

Sending file modes: C0777 1049 file1 
Sink: C0777 1049 file1 file2 
Sending file modes: C0644 722 file2 file2 
Sink: C0644 722 file2 ........................................ 
Transferred: sent 4632, received 2128 bytes, in 0.6 seconds Bytes per second: sent 7810.4, received 3588.2 debug1: Exit status 0
 ============================================== 

文件 1 = 1049 字节

文件2 = 722 字节

总计应为:1771 字节

答案1

您可以使用该-v标志来更详细。这还会在命令完成之前将发送/接收的字节数打印到 stderr。

例如,这会将两个 1MB 文件复制到目标:

$ scp -v -r dir1 user@host:/tmp/
...
Entering directory: D0775 0 dir1
Sink: D0775 0 dir1
Sending file modes: C0664 1048576 file1
Sink: C0664 1048576 file1
file1                                                                                                                      100% 1024KB  22.5MB/s   00:00
Sending file modes: C0664 1048576 file2
Sink: C0664 1048576 file2
file2                                                                                                                      100% 1024KB  29.3MB/s   00:00
Sink: E
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 2102108, received 2940 bytes, in 0.7 seconds
Bytes per second: sent 2846707.3, received 3981.4
debug1: Exit status 0

相关内容