SSH / Shell - delete all folders with the name "____" in the folder AND subfolders

I have a script that copies a folder containing a couple of additional folders. The original that it copies is part of the SVN folder, so it also copies the ".svn" folders.

I want to remove them from a new destination, I would prefer:

rm -Rf dir/*.svn 

What doesn't work, is there a way to do this, or do I need to manually go to each folder to delete it?

+4
source share
2 answers

From the folder whose contents you want to filter:

find . -name '.svn' -print0 | xargs -0 rm -rf

or

find . -name '.svn' -exec rm -rf {} \;

+11
source

Source: https://habr.com/ru/post/1312481/


All Articles