9

I want to copy a bunch of folders recursively. However, I don't want one error preventing the copy from finishing. Is there any way to do a recursive copy(cp -R), ignoring (but logging) all errors produced? I'm on Mac OS X, but I assume the answer would be the same for *nixes.

14

Hey, you might want to check out rsync ( http://www.samba.org/ftp/rsync/rsync.html ). It can do a more reliable job and only copy the files that didn't copy the first time:

rsync -vza --progress /source/ /destination/

Good luck!

| improve this answer | |
  • Absolutely exactly what I needed, with a springling of --exclude="<globpattern>" and --delete to keep a try perfectly synched from one project to the next. – Martijn Pieters Feb 6 '14 at 16:17
4

Found the answer: ditto(1)

| improve this answer | |
  • Please share it here so that future people can learn.. – James Polley Jan 5 '10 at 10:21
  • I did share the answer... it is ditto. Syntax: ditto <src dirs> <dst dir> – Mike Jan 5 '10 at 10:25
  • Odd; when I first viewed this it was a broken image. – James Polley Jan 5 '10 at 10:47
  • You did the right thing by following-up on your question once you found the info, but "answers" that consist only of a link are not future-proof; it's best to embed the information. (Acknowledging here, it's years later... but that's my point. Google sends people here. ) – Scott Prive Mar 18 at 12:14
  • Updated link (tho it's just a man page): web.archive.org/web/20100722111116/http://developer.apple.com/… – Scott Prive Mar 18 at 12:17

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.