How to select all similar files in an directory

Solution 1:

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

Solution 2:

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 {} \;