Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 13 down vote accepted

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.

share|improve this answer
    
thx dude, you made my day. This is exactly what I was looking for! – Produnis Feb 22 '13 at 13:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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