bash 将 rsync --stats 输出转换为 GB?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12511636/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 03:19:53  来源:igfitidea点击:

Converting rsync --stats output to GB?

bashrsync

提问by Sandra Schlichting

When using --statswith rsync, you get a report at the bottom of the transfer log.

--stats与 rsync 一起使用时,您会在传输日志的底部看到一个报告。

Number of files: 211009
Number of files transferred: 410
Total file size: 903119614118 bytes
Total transferred file size: 9046197739 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 5864077
File list generation time: 23.204 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 5865513
Total bytes received: 1441

I would like to convert Total file sizeand Total transferred file sizein place to GB, so it becomes

我想转换Total file sizeTotal transferred file size就地到 GB,所以它变成

Number of files: 211009
Number of files transferred: 410
Total file size: 903 GB
Total transferred file size: 9 GB
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 5864077
File list generation time: 23.204 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 5865513
Total bytes received: 1441

Question

How should that be done?

那应该怎么做?

回答by keks

rsync --stats -h /your /paths --and --options

rsync --stats -h /your /paths --and --options

-hstands for human readable.

-h代表人类可读。