Client Login
Bulk add missing files to Subversion
I often need to add a lot new files to my subversion repository, especially when updating many modules in Drupal. When new files exist all over the directory structure, you can't do a simple svn add. In comes the magic of the UNIX command line, with a combination of svn, grep, and awk tied together with pipes:
svn st | grep ^? | awk '{print $2}' | xargs svn addThis works great for most files, but what if, heaven forbid, one of your files has a space in it? awk will only print out the second "field", delimited by spaces, so it won't print out the full file name if it has spaces in it. The solution is to replace the awk command with another handy utility: sed.
svn st | grep ^? | sed 's/? //' | xargs svn add
The same can be done to remove missing files, by altering the grep command:
svn st | grep ^\! | sed 's/? //' | xargs svn add
- Jon Duell's blog
- Login or register to post comments






