Super User is a question and answer site for computer enthusiasts and power users. 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 the following 2 source folders:

  • A is the base folder, its size is 1GB.
  • B is the change folder, its size is 100K. B has the same folder structure with A, but files only exist when it needs to be different with A.

What I want is "A + B = C". I clone A folder to C folder with rsync first. And then I use rsync again to overwrite the files in C folder from B folder.

The problem is that it still takes too much time even if the C folder exists. Any solution to fasten this process?

share|improve this question
Is there a reason you're using rsync? Why not just cp -r A C, then cp -r B/* C? – Nicole Hamilton Jan 14 '13 at 4:40
With rsync I can exclude unnecessary files easily. I don't know how to do that with cp. – josephj Jan 14 '13 at 4:59
How do you decide what's "unnecessary"? If you thinking about the case where C already exists and may already have some up-to-date files, use the cp -u option to copy only when the source is newer than the destination or when the destination is missing. – Nicole Hamilton Jan 14 '13 at 5:20
what are the rsync options that take too long for copying B to C? – sparkie Jan 14 '13 at 5:23
@NicoleHamilton It means something like .git or the application folder which doesn't have to be included in this deployment. However, use the cp -u is indeed faster than rsync. I might change my approach for that. – josephj Jan 14 '13 at 5:49

You must log in to answer this question.

Browse other questions tagged .