why does --size-only not detect change only is size (but also time)?

Matt McCutchen hashproduct+rsync at gmail.com
Thu Apr 19 00:01:15 GMT 2007


On 4/18/07, CSights <csights at fastmail.fm> wrote:
>         I'm wondering why when I use --size-only on the same file, except the
> modification time, rsync transfers the modification time?
>         I was under the impression that --size-only caused rsync to transfer files
> based upon differences in the size of the file.
[...]
> #rsync -ani --size-only Untitled.pdf Untitled-2.pdf
> .f..t...... Untitled.pdf
[...]
>         It seems to me as though this file should not be transfered because the sizes
> are the same.

The first character of the itemize line is a period, which means that
rsync decided that the file's data was the same on both sides and thus
didn't transfer the file per se.  (If rsync did transfer it, the
character would be a < or >.)  All rsync did was copy the mtime, which
you asked it to do by passing -a, which includes --times.

If you don't want to copy mtimes at all, add --no-times somewhere
after the -a on the command line.  Then transferred files will have
their mtimes set to the current time by virtue of rsync modifying
their data, while other files' mtimes will be left alone.  I don't
think there's a way to copy mtimes on transferred files but not
already up-to-date files.

Matt


More information about the rsync mailing list