Add multiple files in subversion at once.

This works if all of the files that `svn info` lists as ‘?’ are files you actually want to add:

svn st | grep "^?" | awk '{ print $2}' | while read f; do svn add $f; done

If you want to see what’s going on there, start by running svn st and add new sections of the pipeline one at a time to see what each is doing.

social bookmark of choice:
  • Digg
  • del.icio.us
  • Ma.gnolia
  • Reddit
  • Slashdot

Tags: ,

2 Responses to “Add multiple files in subversion at once.”

  1. Darren Kulp Says:

    I’ve done similar (though with cut instead of awk) and this will usually work, but if it’s possible you’ll work with files with spaces in their names, surround the “$f” with double quotes. xargs should work too, though I haven’t tried it, and might be faster on a large add.

    Nice tip.

  2. Basti Says:

    Great tip. It really helped me as I needed to add over 50 files - and I’m to lazy to do it by hand. Thanks.

Leave a Reply