rsync
我正在使用从服务器 A 向服务器 B发送文件。服务器B
的存储空间有限,因此一旦发送文件,它们就会被复制和删除。因此rsync's
--ignore-existing
在这种情况下使用不起作用。我想知道是否有任何方法可以记录我发送的文件的名称,使用rsync
,这样我就可以将名称保存在文件中并使用--exclude-from
答案1
你读过 rsync 文档吗?在这种情况下,阅读 CLI 工具文档应该始终是你的第一研究方向。
这一切都在 rsync 手册页中非常清楚地列出:
--log-file=FILE
This option causes rsync to log what it is doing to a file. This is similar to the logging that a daemon does,
but can be requested for the client side and/or the server side of a non-daemon transfer. If specified as a
client option, transfer logging will be enabled with a default format of "%i %n%L". See the --log-file-format
option if you wish to override this.
Here’s a example command that requests the remote side to log what is happening:
rsync -av --remote-option=--log-file=/tmp/rlog src/ dest/
This is very useful if you need to debug why a connection is closing unexpectedly.
--log-file-format=FORMAT
This allows you to specify exactly what per-update logging is put into the file specified by the --log-file
option (which must also be specified for this option to have any effect). If you specify an empty string,
updated files will not be mentioned in the log file. For a list of the possible escape characters, see the "log
format" setting in the rsyncd.conf manpage.
The default FORMAT used if --log-file is specified and this option is not is ’%i %n%L’.