7

Say I have a big nested directory projects/ and I want to recursively copy the entire directory excluding any sub-directory with the name node_modules/ or env/.

I don't know how many node_modules/ or env/ directories there are and they can be at any level in the projects/ tree. I.e. there could be a projects/project-1/env/ and a projects/project-2/app/node_modules.

How would I go about doing this?

8
rsync -rv --exclude=node_modules --exclude=env /projects /destination
  • Thanks! Didn't know that the --exclude option worked recursively – lsimmons Feb 14 '17 at 19:39

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.