Hello, A few days ago I posted a question about handling timestamps in rsync (Q: rsync - preserve timestamps, but not use it to define files to update), but did not get a single response, so I thought I'd rephrase it. Also, with a new release of rsync out, may be there is some more time that knowledgeable people have :-) So here it goes. I want to be able to do two things together: -- transfer files from the source to destination only if the files' contents is changed -- when the files are transfered, I want to preserve original timestamp The first item is taken care by --size-only and --checksum The second - by --times. However, when the two are combined, the destination gets updated whenever the files in the source are touched. I have a directory, where some tool creates files - database exports, for example. I want to check in these exports into a source control, which is timestamp sensitive and I do not want to create a new version every time the file is exported. So I have a staging area, where the data gets exported from the database, and I want to update my source control work area from the staging, but transfer only files, which actually changed. By looking at the switches available in rsync, I assumed that a combination of --times and --checksum would do what I want, but apparently, --times not only tells rsync to preserve timestamps on transfer, but also to consider the files for the transfer if there is a discrepancy in the mtime of the files. You help is highly appreciated. Eugene.
On Wed, Mar 30, 2005 at 09:16:03PM -0800, Eugene Kramer wrote:> However, when the two are combined, the destination gets updated > whenever the files in the source are touched.Just to be clear, the timestamp gets changed, though the file is not transferred due to the --checksum option (the --size-only option has no effect with --checksum). Rsync always brings the destination in sync with the source with whatever attributes you've told it to preserve, so what you're trying to do won't work. ..wayne..
> I want to be able to do two things together: > -- transfer files from the source to destination only if the files' > contents is changedrsync -avr Consider: -W -x --delete --delete-excluded --log-format='%i %f' Use --dry-run when testing for the right configuration to avoid data loose.> -- when the files are transfered, I want to preserve original timestampTry -a.> By looking at the switches available in rsync, I assumed that a > combination of --times and --checksum would do what I want, but > apparently, --times not only tells rsync to preserve timestamps on > transfer, but also to consider the files for the transfer if there is > a discrepancy in the mtime of the files.rsync's defaults is pretty sane, and does what you want in most cases. Try rsync -avr --dry-run and see, if this doesn't solve your needs.
Seemingly Similar Threads
- SMBFS files receiving incorrect timestamps
- rsync to sync time without attempting to modify the content
- DO NOT REPLY [Bug 6946] New: Enable timestamp comparison with multiple file owners
- Samba vs. Windows : significant difference in timestamp handling ?
- full upload happening even though only a timestamp has changed