如何隐藏现有文件和同步文件的 rsync 输出?

如何隐藏现有文件和同步文件的 rsync 输出?

我有输出:

sent 66 bytes  received 12 bytes  156.00 bytes/sec
total size is 204  speedup is 2.62
sending incremental file list

sent 67 bytes  received 12 bytes  158.00 bytes/sec
total size is 204  speedup is 2.58
sending incremental file list

sent 66 bytes  received 12 bytes  156.00 bytes/sec
total size is 204  speedup is 2.62
sending incremental file list

sent 67 bytes  received 12 bytes  158.00 bytes/sec
total size is 204  speedup is 2.58
sending incremental file list

sent 67 bytes  received 12 bytes  158.00 bytes/sec
total size is 204  speedup is 2.58
sending incremental file list

sent 67 bytes  received 12 bytes  158.00 bytes/sec
total size is 204  speedup is 2.58
sending incremental file list

sent 67 bytes  received 12 bytes  158.00 bytes/sec
total size is 204  speedup is 2.58
sending incremental file list

sent 67 bytes  received 12 bytes  158.00 bytes/sec
total size is 204  speedup is 2.58
sending incremental file list
mysql-bin.000118
            204 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/1)

sent 229 bytes  received 35 bytes  528.00 bytes/sec
total size is 204  speedup is 0.77

有没有办法只显示:

sending incremental file list
mysql-bin.000118
            204 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/1)

sent 229 bytes  received 35 bytes  528.00 bytes/sec
total size is 204  speedup is 0.77

这是唯一丢失的文件。

编辑:谢谢 BowlOfRed,我正在使用:

rsync -azvp --progress --ignore-existing

现在我在答案中使用 as 并且它有效。

rsync -azp --info=name,progress --ignore-existing

答案1

您没有提及如何调用 rsync 或您正在使用什么版本。这看起来像您正在使用-P,它设置的内容类似于-v提供增量列表进度以及最后的统计信息。

我不知道如何为覆盖的传输提供“发送增量”和结束统计信息,但您可以将它们都删除并仅提供进度/增量,以便在没有传输文件时输出保持沉默。对于 rsync 3.x,最好通过替换-P为更细粒度的--info.

rsync 3.2.7 的示例:

$ rsync -a --info=name,progress dir/ dir2
$ touch dir/a
$ rsync -a --info=name,progress dir/ dir2
a
              0 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=2/4)
$

相关内容