Short but useful.
Almost everything I do is under version control of some kind. I prefer to use git, but Drupal uses CVS, and a couple of other things I am involved with use Subversion. Sometimes it is useful to remove the files these systems leave behind -- for example, when I upload a web site I've developed to the production server. Doing it by hand is annoying, so here's a quick bash script I threw together, just in case anyone is interested.
#!/bin/bash
# A simple script to recursively remove the .git, CVS, or
# .svn files from a directory.
if [ -n $1 ]
then cd "$1"
fi
find . -name .git -print0 | xargs -0 rm -rf #for git users
find . -name CVS -print0 | xargs -0 rm -rf #for CVS users
find . -name .svn -print0 | xargs -0 rm -rf #for SVN users
exit
If you're interested in borrowing this useful little snippit, it's all yours. (It's probably too short and obvious to be copyrighted anyway, but just in case you're paranoid, I officially give it to the public domain.) Of course, you may wish to comment out the lines that pertain to the systems you don't use.
- HedgeMage's blog
- Login or register to post comments