加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

如何使用rsync获取文件夹大小?

发布时间:2020-12-13 23:52:50 所属栏目:Linux 来源:网络整理
导读:我想知道是否有一种方法(命令)可以用来查找rsync地址的大小,而无需启动同步? 例如,我如何找到rsync的大小://mirrors.standaloneinstaller.com/vim/? 解决方法 如果你结合-n标志(干运行或模拟传输,实际上并不复制任何文件)和–stats你应该能够找出复制的文
我想知道是否有一种方法(命令)可以用来查找rsync地址的大小,而无需启动同步?

例如,我如何找到rsync的大小://mirrors.standaloneinstaller.com/vim/?

解决方法

如果你结合-n标志(干运行或模拟传输,实际上并不复制任何文件)和–stats你应该能够找出复制的文件总数.

示例(模拟本地复制的两个文件,每个445个字节):

$rsync -avz -n --stats . ../test/
building file list ... done

Number of files: 14
Number of files transferred: 0
Total file size: 890 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 299
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 315
Total bytes received: 20

sent 315 bytes  received 20 bytes  670.00 bytes/sec
total size is 890  speedup is 2.66

(注意总文件大小行.)

官方rsync docs状态在–stats部分表示

Total file size is the total sum of all file sizes in the transfer.
This does not count any size for directories or special files,but
does include the size of symlinks.

您还可以考虑以更易于阅读的格式输出数字的-h选项.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读