Removing .svn directories …

For deployment, one should ideally “export” a project that is under version control (subversion, in particular, for the sake of this post). However, at times one ends up deploying a tarball of a checked-out copy of the project on the production server. There is nothing wrong with doing so as long as the checked copy is recent, save for the fact that each directory and subdirectory in that checked copy will contain a .svn directory that holds subversion’s meta-data files along with pristine copies of all the files in the diretory in which that .svn directory exists. These pristine copies are what make possible the magic that is svn diff and svn revert, among other things. The following is a handy little command to reap out all the .svn directories in a checked out copy of a project under subversion:

# find project/ -type d -name '.svn' -print | xargs rm -rf -

One can also avoid piping the output to xargs and use the nearly equivalent -exec switch to find to achieve similar result. I cannot remember at the moment, but there are some drawbacks of using -exec with find. However, your mileage may vary.

Curious readers are welcome to read Linux man pages for xargs and find, along with “GNU Find For Dummies“, an article I wrote for The Slack World.

One thought on “Removing .svn directories …

  1. Pingback: Linux Code and More » Blog Archive » ayaz

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s