rsync -a --update resets status of newer target directories
Matthias Schniedermeyer
ms at citd.de
Wed Jan 15 10:18:13 MST 2014
On 15.01.2014 17:45, Arvid Requate wrote:
> Hi,
>
> this is a question regarding the behavior of the --update option for the
> recursive replication of directories. rsync 3.0.7-2 shows the following
> behavior on a Debian squeeze system (ext4):
>
> After running the following commands the adjusted ownership of the
> subdirectory /tmp/dst/sub below the target directory is overwritten and its
> newer modification time is reset to that of the older corresponding source
> directory:
>
> ####################
> mkdir -p /tmp/src/sub
> rsync -auAX /tmp/src/ /tmp/dst
>
> # now adjust target and update it's mtime
> chown nobody /tmp/dst/sub
> touch /tmp/dst/sub
>
> # mtime and ownership gets reset to root during next rsync:
> rsync -auAX /tmp/src/ /tmp/dst
> ####################
>
> This cought me by surprise, as I expected the --update option to cause rsync
> to consider the modification timestamp of the target subdir as newer and skip
> it. This works for files, but doesn't seem to apply to directories.
>
> Is this behavior intended? If so, is there a combination of options or a
> workaround to avoid changing the status of the target subdirectory (while
> still synchronizing its content)?
As rsync is a tool for unidirectional(!) synchronization of differences
between file-trees. I would think: Yes. That is intended behaviour.
I don't seen an option to only exclude directories if newer, but there
is an option to ignore directory-times completely: --omit-dir-times
--
Matthias
More information about the rsync
mailing list