Q: rsync - preserve timestamps, but not use it to define files to update

Eugene Kramer eugene.kramer at gmail.com
Mon Mar 28 06:22:50 GMT 2005


 Hello listers,

I do not seem to be able to find a combination of rsync switches that
updates destination directory only if the contents of the files
changes *and* preserves files' original timestamps.

What I've tried so far:

1. --checksum --size-only --ignore-times with or without --times switch.
2. --modify-window=4294967295
3. --size-only w/o --times and with -I (upper case i)

The results: either timestamp gets set whenever there is a difference
in the timestamps between src and dst, or the timestamp of the
transmission gets set for the files in the destination.

rsync 2.6.3, Solaris 2.8

Example of a desired behavior.

I have directories /tmp/a  and /tmp/b with the following files:
/tmp/a:
-rw-r--r--   1 user  group          0 Mar 27 17:22 a
-rw-r--r--   1 user  group          0 Mar 27 17:22 b

/tmp/b:
-rw-r--r--   1 user  group          0 Mar 26 16:44 a
-rw-r--r--   1 user  group          0 Mar 26 16:44 b

I want rsync switches that won't update /tmp/b in above case, but if
/tmp/b is empty, I want /tmp/b/a and /tmp/b/b files to be created with
"Mar 27 17:22" timestamp.

Thank you,

Eugene.


More information about the rsync mailing list