6

How do you search for a file of a specific type in OS X Yosemite? I cannot seem to find any instructions on how to do this.

In the Finder search I enter: kind:zip

But it returns all compressed files. I only want zip files - so this AD post does not help me much. All the solutions either use bash, or I cannot find the options they refer to.

Roy Hinkley
  • 457
  • 8
  • 16
  • @patrix Typing "kind:zip" in the Search Field is just plain text not source code and should not be shown as kind:zip and why I originally edited it among the other edits. Why did you change it back? I set it bold to differentiate however it could just be plain as it's plainly evident by syntax it was something typed. – user3439894 Mar 04 '15 at 16:23
  • @user3439894 This is probably not the last discussions we are going to have about formatting on AD, feel free to join in on http://meta.apple.stackexchange.com/questions/2361/why-was-my-edit-removing-code-formatting-reverted :-) In a nutshell: I see a significant difference between putting emphasis on some words and marking text which the user can/should type in. It is (at least on AD) quite common to use code formatting for the latter. If you want to discuss this further, please use the Meta site or the chat room. – nohillside Mar 04 '15 at 16:38
  • I'm going to point this at the existing search question. With some of the great answers here, I'm also considering merging the answers. Ask on [meta] if anyone has strong opinions on the close/merge options. – bmike Mar 05 '15 at 19:35
  • @bmike - I reference that post in my post - it does not answer this specific question. It answers it too generally and most are BASH solutions, not a Finder solution. The answer checked here actually answers this specific question. Thank you for your consideration on not considering this a duplicate, but more of an extension. – Roy Hinkley Mar 05 '15 at 20:05

4 Answers4

5

Open a new finder window and type "zip" in the search. Select "Zip archive" in "kinds".

You can also just type out kind:.zip and press enter and you'll get the appropriate filter:

enter image description here

Note - omitting the . after the : results in many compressed files and not just those with .zip extension or literal conformance to that specification.

bmike
  • 235,889
nicael
  • 763
3

Type +F on Finder and you will see the search bar. By default appears Kind is Any. Replace Kind with File Extension (you can find it under Others...), then you can type zip in the field and you will have the results immediately.

Additionally if you feel confortable with the Terminal, you can use the following command:

find . -name "*.zip"
user3439894
  • 58,676
jherran
  • 13,284
  • 1
    I appreciate the BASH solution (which I already know) - I want to learn how to do this through Finder if possible. – Roy Hinkley Mar 04 '15 at 15:26
3

You can directly search for zip files by entering:

kMDItemFSName:.zip

or even better:

kMDItemKind:"Zip"

into Spotlight Search in Finder.

To get more kMD* keywords make mdls /path/to/file in Terminal to list them.

Here is great pdf with a list of search attributes and other hints.

  • 1
    Awesome resource at http://hints.macworld.com/dlfiles/spotlight_cmds.pdf - cheers and thanks for that! – bmike Mar 05 '15 at 19:36
0

Building on @mateusz-szlosek's answer:

in your .bash_profile, add the following two helper functions:

# search below current dir. syntax: f queryterm
f()
{
     mdfind -onlyin . "$2" 
}
# search below current dir, with extension. Syntax: f2 extension queryterm (e.g. f2 py hello)
f2()
{
     mdfind -onlyin . "$2" kMDItemFSName:."$1"
}

You can then search for zip files like this:

f2 zip blabla
Renaud
  • 151