Rsync:提供未发送文件列表

5

Rsync 的 -u 标志可以防止覆盖已修改的目标文件。如何获取由于此标志未发送的文件列表?-v 标志将告诉我哪些文件被发送了,但我想知道哪些文件没有被发送。

1个回答

7

来自rsync手册:

-i, --itemize-changes

Requests a simple itemized list of the changes that are being made to each file, including attribute changes. This is exactly the same as specifying --out-format='%i %n%L'. If you repeat the option, unchanged files will also be output, but only if the receiving rsync is at least version 2.6.7 (you can use -vv with older versions of rsync, but that also turns on the output of other verbose messages).

在我的测试中,使用rsync 3.0.8时,-ii选项无法工作,但是-vv可以。具体情况可能因人而异。
您也可以通过在相反的方向上使用--dry-run--existing来获得基本相同的信息。因此,如果您的常规传输如下所示:
rsync --update --recursive local:/directory/ remote:/directory/

您需要使用以下内容:
rsync --dry-run --existing --recursive remote:/directory/ local:/directory/

但是使用-vv-ii更安全,更不容易被误解。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接