Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 directories that look like this:



I'd like to copy all of the files from folder2 into folder1 without deleting any of the existing folders, so that I end up with the following:


how can I accomplish this via the terminal?

share|improve this question

rsync is a perfect tool for this job:

rsync -av folder2/ folder1

The -v option is optional, but it lists files as they're processed. The slash after folder2 is required, otherwise you'll get folder1/folder2/file1.txt instead of folder1/file1.txt.

If you're not sure whether the command does what you want, add the --dry-run option to show what would actually happen.

share|improve this answer

Your Answer


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.