Reputation: 674
I am trying to find all files ending in .jar, but it is picking up folders that ends in .jar which is something I do not want.
My command so far
find . -name ".*jar"
I need it so it ignores directories ending in .jar
Additional request.
I now need to ignore a specific folder when looking, is this possible?
Thanks.
Upvotes: 0
Views: 1180
Reputation: 74018
Others have already shown, how to pick up files named ending in .jar
. As an answer to your comment "How to ignore a specific folder". You use -prune
for that
find . -name 'specific/folder' -type d -prune -o -type f -name '*.jar'
Upvotes: 2
Reputation: 4404
that's what you want
find . -type f -name "*.jar"
see man page:
-type Type
Evaluates to the value True if the Type variable specifies one of the following values:
b
Block special file
c
Character special file
d
Directory
f
Plain file
l
Symbolic link
p
FIFO (a named pipe)
s
Socket
Upvotes: 0