呃!

呃!

目前,我正在尝试在两个文件夹之间复制修改后的文件,并希望将有差异的文件复制到该new文件夹​​中。

文件夹结构如下:

..
|-- update+old
|   |-- new
|   `-- pt
|       `-- abc
`-- web
    `-- abc

快速解释一下:

update+old/new- 新文件应该在哪里(--compare-dest)
update+old/pt/abc- 原始文件(目标)
web/abc- 我更改的文件(源)

我正在运行命令:

rsync -av "$PWD/web/abc/" "$PWD/update+old/pt/abc/" --compare-dest="$PWD/update+old/new/"

它只是跳过new并直接进行所有更改update+old/pt/abc/update+old/new/完全留空。

我尝试了--dry-run-n),但它没有提供任何信息。 (以前常说不update+old/new/存在)

我是否做错了什么或者我误解了论证的用处--compare-dest=


如果需要的话,这是rsync --version在 Debian 8.6 上运行的输出:

root@webtest:/var/www/c1s.int# rsync --version
rsync  version 3.1.1  protocol version 31
Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

这是几个小时前通过运行安装的apt-get install rsync

答案1

呃!

目录是交换了

命令应该是这样的:

rsync -av "$PWD/web/abc/" "$PWD/update+old/new/" --compare-dest="$PWD/update+old/pt/abc/"

它仍然没有达到预期的结果(它只是复制所有内容),但这是另一个问题。

相关内容