I want to implement a comprehensive backup script based on rsync, so I'm just experimenting now to decide the correct parameters based on my requirement. Basically, I want that any changed file should be copied from source to destination, regardless of its modification time (ie. whether or not source file is older/newer than destination file, it should be copied if the contents differ). However, it isn't working:


Above is the folder structure. When I first ran the below command for first time, it copied the test.txt from src to dst folder.

rsync -avh --ignore-times src/ dst/

Then, I modified the contents of src/test.txt and ran above command again, and this time too it copied the updated file to dst folder.

However, I then modified the test.txt in dst folder, and ran above command, but this time, it didn't work and didn't copy the file from src/ to dst/ folder. But considering this answer, it should have worked as I've added the --ignore-times parameter.

Is this a bug with Ubuntu, or am I doing something wrong? What parameter should I add so that the file will be always copied from source to destination when the contents differ (even when the destination file is newer)?


--archive equals -rlptgoD while -t means

-t, --times
    This tells rsync to transfer modification times along with the files and update them on the remote system

But you could combine that with --no-OPTION like this

rsync -avh --no-t --ignore-times src/ dst/

and it should work perfectly

EDIT: actually the --ignore-timesis superfluous, this is enough

rsync -avh --no-t src/ dst/
  • For some reason, --no-t does not prevent the tag 'T' to appear, even with --ignore-times. – Luis A. Florit Feb 20 '19 at 23:57
  • @LuisA.Florit, what do you mean ?? What is a tag in this context ? – Robert Riedl Feb 21 '19 at 8:04
  • Sorry, maybe I was not clear. I was referring to the 'T' tag under transfer. If you look for ' T ' (beware the two spaces) in the man page, it says: An alternate value of T means that the modification time will be set to the transfer time, which happens when a file/symlink/device is updated without --times and when a symlink is changed and the receiver can't set its time. (Note: when using an rsync 3.0.0 client, you might see the s flag combined with t instead of the proper T flag for this time-setting failure) I was not able to make rsync to really ignore times (no reporting this). – Luis A. Florit Feb 21 '19 at 20:08

For some reason, the --archive or a mode doesn't seem to work with the --ignore-times or --checksum parameters. However, the simple recursive copy mode (--recursive or r). So in my case, the following did the job perfectly:

rsync -vcr src/ dst/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.