Re: bash script question
On Fri, Apr 18, 2008 at 10:27:30AM -0600, ChadDavis wrote:
> I have a simple bash scripting question.
>
> I have a tree of directories from which I would like to recursively dig into, removing source
> control meta-information from. In this case, the meta-data is in .svn folders.
>
> Does anyone have any elegant suggestions on how to do this?
If you want to remove the .svn/ directories and everything within them, something
like this should work (remove the 'echo' if the output looks ok):
$ cd starting/directory
$ find . -type d -name .svn -exec echo rm -r {} \;
or:
$ find . -type d -name .svn | xargs echo rm -r
I'd recommend EXTREME CAUTION any time you're scripting rm, particularly with
the -r option. Often you may need to do this as root to have rm work without
prompting, and it's easily possible to do real damage by accident...
Ken
--
Ken Irving, fnkci+debianuser@uaf.edu
Reply to: