Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

If I want to view images I made with my camera using Preview, I have to select all files separately. Because when I select all files (cmd + a) all the videos I made get selected (and opened in Quicktime) too.

So I was wondering how I can select only the images in a certain directory?

share|improve this question
    
Interested to see all the different ways people suggest you limit the view to certain types. There are many. –  Ian C. Apr 23 '12 at 23:26

2 Answers 2

You can use the Search feature in Finder to limit the view in a specific folder to search criteria that matches what's in the search field. One of the criteria you can search on is kind. In the screen shot below I start typing kind:jpeg in the search field and you see that Finder presents me with a drop down list that includes JPEG Image. I select this from the list and I'll see only files of that kind. To limit the filter to just this folder I make sure the Downloads view is clicked on the Search: area just about the list of files instead of This Mac.

Once you've searched and filtered your view this way, you can select all to perform an operation on files that match that search.

Searching by Kind

share|improve this answer
    
Is it possible to search for multiple "kinds" with this approach? –  E1Suave Apr 25 '12 at 17:12
1  
Yes and no. There are broader kinds you can use. Try: kind:image to see all image files. Or kind:movie to see a video files. There's a OR operator, |, for searches but it doesn't seem to work with the kind: filter. –  Ian C. Apr 25 '12 at 17:21
    
Thanks, I also tried the, | ,operator and found no success with "kind:". Thanks for the tip on "kind:image" –  E1Suave Apr 25 '12 at 17:26

If all of the images have the same extension the following command (when run in Terminal.app) will search your directory for files with that specific extension and open them in Preview.

find /yourdir -maxdepth 1 -type f -name '*.jpg' -exec open -a /Applications/Preview.app {} \;

If you want to search through multiple directories and not stop at the root directory (in this case "yourdir" you can remove the "-maxdepth 1" portion.

If you want to search for multiple file extensions (jpg and tif) use the following command.

find /yourdir -maxdepth 1 -type f \( -name '*.jpg' -o -name '*.tif' \) -exec open -a /Applications/Preview.app {} \;
share|improve this answer
1  
That seems a bit overkill. Your first example can be achieved with open *.jpg, assuming Preview is the default for .jpg files - if not, then /Applications/Preview.app *.jpg should also work. If you want to search the subdirectories, you'd need a find as you suggest. Likewise, for multiple file extensions, open *.jpg *.tif should work. –  cm2 Apr 24 '12 at 0:18
    
Very true. Normally I would not include the "open -a /Applications/Preview.app" and instead simply execute the open command, but not knowing everything on martin's system I felt it may be best to declare Preview as the application to open the images in. :) –  E1Suave Apr 24 '12 at 0:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.