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.
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:
将xargs
与管道衬里配合使用-
$ find . -name *.class | xargs rm *
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.