Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Say I have a lot of files that I want to add then check in at once. But consider that CVS folder should be excluded. What kind of command or script can be used in order to do this?

I have tried

find -name "*" -type f | xargs cvs add

to add files to repository, but it does not work. Any ideas?


share|improve this question
up vote 2 down vote accepted

Try this to find all files in the current directory and add them to cvs:

find -maxdepth 1 -type f -exec cvs add {} \;

Another set to consider as arguments to find would be -not -name CVS if you wanted to exclude something by name (not necessary above because we are only looking at files, not folders).

share|improve this answer
But why xargs does not work? – Narek May 19 '11 at 11:53
Likely because of issues with spaces in filenames. You have to be very careful how you use xargs. find […]|xargs -n1 -iX "X" cvs add might have worked by running one argument at a time and making sure it was quoted. Using -exec is an easier way to avoid that mess. – Caleb May 19 '11 at 11:54

Try with something like:

find . -type f -a ! -wholename "*/CVS/*" -print0 | xargs -0 cvs add
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.