Petri Lehtinen
Petri Lehtinen

Reputation: 2145

How to make rsync preserve timestamps of unchanged files

I use a static website generator that generates all the files in the website on each run. After generating the files, I use rsync to copy the content in place.

To allow better caching, I'd like rsync to not modify the timestamp of those files in the destination that have not changed. Is it possible?

EDIT: To make it clear, timestamps of all the source files are always newer than the timestamps of the destination files.

Upvotes: 10

Views: 15534

Answers (2)

Petri Lehtinen
Petri Lehtinen

Reputation: 2145

The -c option seems to do what I want. The performance penalty is not an issue in my case.

Upvotes: 17

MarcB
MarcB

Reputation: 559

Have you tried the -t and -E flags?

EDIT: Uh... or is the timestamp of the source files changed every time you regenerate the website, even if the files haven't changed?

Upvotes: 0

Related Questions