I have some folders that got duplicated by mistake and I have to merge them together. Let's say folder A contain file X and folder B contains file Y, I would like to get file X copied to folder B. But, of course, I can face more complex cases, where f.i. both folder A and B contain the same file X: in those cases, I would like to keep the newest copy of the file, so rsync should compare both files, and if the origin is older just skip, it otherwise the destination is the older one, overwrite.
Which parameters should I put on the rsync command line?
This is what I found googling, but I do not think is correct.
rsync -avz --ignore-existing src dest
The man page is somehow beyond me.
P.S. In those cases where a file exists in both folders, the better thing would be to overwrite the older one into the destination folder and at the same time keep a copy of the older, just as a backup in case you should get back to the previous