Reputation: 455
I have a directory named classes
which contains a lot of sub-directories -
classes
|-security
|-registration
|-service
....
Each of these directory contains a lot of java
files and their compiled classes files. I want to remove all the class file.
Going to classes
directory I can list out all the class file using find command -
$ find . -name *.class
Is there any command in linux to remove all the classes file under the classes
directory.
Upvotes: 0
Views: 3504
Reputation: 54583
The usual answer uses the -exec
option of find
:
find . -name "*.class" -exec rm {} \;
Be sure to quote the wildcard, to ensure that it is passed into find
(rather than globbed by the shell, first).
For further discussion, see these questions:
Upvotes: 1