I have the following scenario:
I have files in one directory where there is a process that is changing some files and updating the ctime on all files. I want to rsync all files to a target directory but preserve the ctime of those files that only got their ctime updated.
I have tried the following (~/source/test.txt is my source file and ~/target/test.txt is my target file).
chmod a+w source/test.txt (updates ctime but not mtime)
rsync -a -v -c --copy-dirlinks --delete --partial --inplace source/test.txt target
My expectation was that those files that have only their ctime updated in the source directory do not get rsync'd and apparently that is the case. But the corresponding file in the target directory still gets its ctime updated – which is currently causing trouble with my backup process.
Is there any way to have rsync not update the ctime for files that have not been modified?
Best Answer
You could try if the
--checksum
option does what you want:When doing a short test, this worked, but not when using the shortcut
-a
option, maybe because it includes-t
, which preserves mod times.