[lug] Removing hidden directory recursively

John-David Childs hobbes at netgnome.net
Tue Apr 25 18:03:46 MDT 2006


On 4/21/06, Hugh Brown <hugh at math.byu.edu> wrote:
>
>
> find . -type d -name .svn -exec echo {} \;
>
> to make sure you aren't getting something you didn't intend and then
>
> find . -type d -name .svn -exec rm -rf {} \;


Nuh-uh...this will remove any directory containing a .svn extenion AND ALL
FILES in all subdirectories, regardless of .svn extension!

What you want is this:

find . -type f -name "*.svn" -exec rm -f {} \; && find . -type d -empty
-exec rmdir {} \;

This will remove all files with an .svn extension and remove any empty
directories afterwards.


depending on how many there are you can also use:
>
> find . -type d -name .svn -print0 |xargs -0 rm -rf
>
> Hugh
>
> On Fri, 21 Apr 2006, Paul Nowosielski wrote:
>
> > Dear All,
> >
> > I'm trying to remove 1000's of .svn files from a web directory.
> > Can any one give me a tip on how to do this with a one line command?
> >
> > Best,
> >
> > --
> > Paul Nowosielski
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20060425/fedf84d0/attachment.html>


More information about the LUG mailing list