How to add multiple files to Subversion July 10, 2006

Posted by Slobodan Kovacevic in : Resources and Links , trackback

After switching completely to Ubuntu I also had to switch from TortoiseSVN to plain svn command line. The problem I have is that I don’t see any way to add multiple files to SVN with one command.

I want to be able to add ALL files that aren’t under Subversion version control and use a single command to do it (as opposed to issuing bunch of ’svn add file1 file2…’ commands). I’d like to have something like:

svn add ./*

Now since I’m lazy and not exactly an shell scripting expert I found a someone else’s solution to this problem. In a blog post add multiple files in subversion at once proposed solution is to use following line (it’s a slightly modified version of original line):

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

Basically, it will first list all files that have been changed, then filter out those that have ? as status (hint: files that aren’t under version control), extract file names and then for each file issue a separate ’svn add’ command. I just tried it and it works great.

Comments»

no comments yet - be the first?