'shell script to remove folder from sub directories with different names

I want to remove particular directory named "classes" from all web applications with different names inside webapps folder.

For example, I want to remove folder name "classes" from /tomcat6/webapps/abc, /tomcat6/webapps/xyz, /tomcat6/webapps/xxxx etc.

Can some one please help me to make a shell script to accomplish this?



Solution 1:[1]

This may not be the most efficient one but will do the work.

First verify the directories.

find /tomcat6/webapps | grep "classes$"

If this list seems ok, then actually delete it.

find /tomcat6/webapps | grep "classes$" | xargs rm -Rf

Please be careful with deletion as they are not undoable once done.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tilmik