Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-09-21 16:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (172 votes), past polls