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?

Thanks!

link|improve this question

74% accept rate
feedback

2 Answers

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).

link|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
feedback

Try with something like:

find . -type f -a ! -wholename "*/CVS/*" -print0 | xargs -0 cvs add
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.