Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: Find all JPEG files in a directory

by extremely (Priest)
on Aug 12, 2005 at 13:21 UTC ( #483271=note: print w/ replies, xml ) Need Help??

in reply to Re: Find all JPEG files in a directory
in thread Find all JPEG files in a directory

"grep jpg"? No login for you on my systems. :) One of these will actually find most if not all of the files with a JPEG extension without matching files like "not_a_jpg.gif". Whenever you have a fairly simple match, you'll come out ahead using the find built-ins rather than piping to grep.

find . -name '*.jpg' -o -name '*.jpeg' -o -name '*.JPG' -o -name '*.JPEG'

find ./ -name '*.[Jj][Pp][Gg]' -o -name '*.[Jj][Pp][Ee][Gg]'

And if you must use grep, do it right!

find . | grep -i '[.]jpe\?g$'

find . | egrep -i '[.]jpe?g$'

$you = new YOU;
honk() if $you->love(perl)

Comment on Re^2: Find all JPEG files in a directory
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://483271]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2015-11-28 01:27 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (737 votes), past polls