Mark Dorison

Adding All New Files to Subversion

One thing that has always bothered me when working with Subversion is the inability to easily add a large number of new files to the repository. Subversion does not have an equivalent of 'git add *', so we are left to add all of the new files, at best, one folder at a time.

Imagine doing this for a Drupal site that hasn't been touched in a while and you need to apply security updates for core, along with a large number of modules. You could very easily spend more time typing in all of your 'svn add ...' commands than getting the updates applied.

Using the following command, you can affect an 'svn add' command on every line returned from 'svn status' that has a question mark associated it (ie. new to the repository).

svn status | grep "?" | while read f; do svn add $f; done

Hopefully, this should make adding large numbers of new files to Subversion quite a bit easier. Of course, you could always just use git!

← Home