I'm using rsync
to copy some source code. The copied code must not be modified at the destination place by my mistake while code editing. So I set --chmod=u-w
flag to make it read-only after copying.
rsync --delete -a --chmod=u-w
First is working well. But from second time rsync
cannot perform copying because destination is read-only.
rsync: delete_file: unlink "/path/file1" failed: Permission denied (13)
rsync: delete_file: unlink "/path/file2" failed: Permission denied (13)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
I believe there's some feature that forces rsync
to overwrite any files regardless of readonly or writable.
How can I do that?