Beacon Hill, Inc. Technology Solutions

Home > Knowledge Base > Bash > Recursively Add to CVS

Recursively add files and directories to CVS

If you've just started a project and have a lot of files and directories to add to CVS you may get discouraged if you try to add everything by hand.

From following two commands will add directories and files for you recursively.


find . -type d -print | grep -v CVS | xargs cvs add
find . -type f -print | grep -v CVS | xargs cvs add

To make this even easier in Bash you can create the following function and run it from the root directory of your project.


function add-all-cvs () {
    echo "Adding all files and directories from here..."
    find . -type d -print | grep -v CVS | xargs cvs add
    find . -type f -print | grep -v CVS | xargs cvs add
 }

Reference

http://vafer.org/blog/20050107005746