header

Torsten Curdt’s weblog

Recursively adding files to CVS

The following commands can become handy if you are still stuck with cvs and cannot use the excellent eclipse cvs client.


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

5 Responses to “Recursively adding files to CVS”

  1. Amit said, on 13. June 2007 at 20:51

    It is really a great solution. Thanks a lot for reducing my work.

  2. Nikolaus said, on 8. December 2007 at 5:49

    Thanks, this is fantastic

    It did not work for me as specified under bash on OS X, I had to use the following, and note the -n1 parameter for xargs:

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

    the -n1 ensures that cvs add is called only for a single file each time. That’s required because while cvs add can be called with a number of files as argument, if one of the arguments “aborts” the add, the others won’t be added. I found that to happen with the first line which adds the directories. If a directory is already there, cvs add aborts instead of just skipping it like it does with files.

    So it would do a cvs add dir1 dir2 dir3, but because dir1 was already in the repository, it would not add dir 2 and 3. I am not sure it’s required for files, but it can’t hurt.

  3. Todd said, on 6. May 2008 at 21:28

    Thanks guys this is just what I needed. Don’t have eclipse setup on my mac. :(

  4. cowgod said, on 4. November 2008 at 23:39

    thank you, thank you, thank you. awesome.

  5. Todd said, on 20. November 2008 at 18:10

    I love it.

    Thanks!

Leave a Reply

Please copy the string 8ldPJc to the field below: