11

I have two folders (ORIGINAL A and ORIGINAL B), and both do have subfolders.

How do I merge these two folders (and subfolders) to DESTINATION C?

a) ORIGINAL A and ORIGINAL B do have the same subfolders. I want to copy every unique file of any subfolder into the "correct" subfolder of DESTINATION C

b) some subfolders are only in ORIGINAL A, but not in ORIGINAL B. I want any folder in DESTINATION C

Does anyone know a terminal command?

15

Try:

rsync -aP /ORIGINAL_A/* /DESTINATION_C/

This is like a copy of the folder A

rsync -aP /ORIGINAL_B/* /DESTINATION_C/

That should sync the folders A an B to another the new folder C.

You could sync the file from A to B directly but you don't will have data loss this way.

  • thx dude, you made my day. This is exactly what I was looking for! – Produnis Feb 22 '13 at 13:52
  • What to do if rsync is not available? How to do it with CP? – Max Jan 23 '17 at 17:05

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.