We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

tylerhall on 04/08/08


Tagged

svn Bash recursive add


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

noah
moonbather


SVN Add Recursively


Published in: Bash 


This adds all new files to SVN recursively. It doesn't work for files that have spaces in their name, but why would you create a file with a space in its name in the first place?

  1. svn status | grep "^\?" | awk '{print $2}' | xargs svn add

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: Tenzer on April 9, 2008

I think this should work with files which contains whitespaces as well, at least from my testing: svn status | sed -n '/^\?/ s/\? //; s/ /\ /p' | xargs svn add

Posted By: Tenzer on April 9, 2008

I just noticed that the extra whitespaces was removed from my post. This corrects it, and is probably also better: svn status | sed -n '/^\?/ s/\?\s+//; s/ /\ /p' | xargs svn add

Posted By: fenice on April 10, 2008

This latest command doesn't work for me, it doesn't remove lines with ! at the beginning. Here is my solution to add new files to svn (also files with whitespaces) :

svn status | grep '^\?' | sed -e 's/^? (.)/\1/;s/ /\ /g' | xargs svn add

Posted By: fenice on April 10, 2008

This latest command doesn't work for me, it doesn't remove lines with ! at the beginning. Here is my solution to add new files to svn (also files with whitespaces) :

svn status | grep '^\?' | sed -e 's/^? (.)/\1/;s/ /\ /g' | xargs svn add

You need to login to post a comment.