6

Although Windows defines the file type on the basis of the file extension, some types cover multiple extensions (e.g., "JPEG Image" covers .JPG and .JPEG), and others use extensions that are substrings of other extensions for unrelated types (e.g., "Markdown files" are .md, which is a substring of .mdb (an Access database) and .mdi (Microsoft Document Image file). If I want to search for "JPEG Image", or "Markdown file", and get only the required file types... how do I do it?

  1. Explorer, batch, or PowerShell solutions are acceptable.
  2. The ideal solution will work for both Windows 7 and Windows 10, but separate solutions for Windows 7 and Windows 10 are also acceptable.
  3. I would prefer not having to analyze and use explicit file extensions in the search.
5
  • I'm unsure what you are asking. Are you trying to sort or search for files with a specific type? If you are trying to search for a specific type (Like .JPEG), why do you not wish to search by the extension? May 16, 2017 at 19:47
  • 1
    Search, not sort; and searching by the extension in some cases will not get all of the files of the type (e.g., .JPEG misses the "JPEG Images" that are .JPG), and in other cases will get too many files (e.g., .md in the Explorer search box will get not only "Markdown files", but "Access database files" (.mdb)). May 16, 2017 at 19:49
  • For the case of .JPG and .JPEG, since they are both technically .JPEG files. You can search using explorer by typing type:=.JPEG in the search box and it should find all .JPEG files, regardless of their extension May 16, 2017 at 19:53
  • 1
    Nope. type:=.JPEG omits .JPG. May 16, 2017 at 19:55
  • Sorry, I mistyped. Give type:.jpeg a try. I just tested it now and it returned both .jpg and .jpeg files. May 16, 2017 at 20:00

2 Answers 2

4

A few things about Windows and the search function in the File Explorer:

  1. Windows doesn't know about mime-types such as "JPEG Image" or "Markdown file" (or their respective (sub-/super-)types
  2. The search is very powerful, if used correctly.

To answer your question:

To search for a specific extension (file type in Windows) use the search query:

  • Search for all .md files and only those files (should be markdown files): type:".md" (remember the quotation marks, if you want an exact match)
  • Search for all images: kind:=image (yes, you can search for this)
  • You can combine all filters and search terms how you like it.

More info and examples here: https://www.howtogeek.com/73065/learn-the-advanced-search-operators-in-windows-7/

6
  • +1. Although you can search for some files regardless of the sub types. Not sure about all types, but some allow you to. Such as .JPEG, which will find all of the sub types such as .JPE .JPG .JFIF if you search with type:.jpeg Also, it does not seem quotations are required, but return the same result. May 16, 2017 at 20:15
  • @CheesusCrust the quotation marks are required when searching for an exact match. Otherwise .mdb files (like the OP stated) are found.
    – GiantTree
    May 16, 2017 at 20:43
  • Ah, I see. I thought the OP meant to find more rather than less. Whoops! Thanks for sharing the link too. May 16, 2017 at 20:44
  • 2
    type:".md" did not work (false negatives - no matches) when I tried it on Windows 10 (in a folder with 11 .md files). Aug 1, 2018 at 14:00
  • 2
    @GiantTree, as Peter Mortensen explains, type:".md" is not correct. It should be type:=".md" with an =. I'd suggest testing it, and then please update your answer.
    – Codesmith
    Feb 12, 2021 at 16:26
0

To search in Windows using the "type:" syntax, you want to do

type:~ Note the tilde.

For example I wanted to find Word Documents, where if you're looking in explorer browser, the "Type" column will identify as "Microsoft Word Document", I used:

type:~"Microsoft Word Document"

The results returnd only Word Docs and even highlighted the text in the "Type" column.

I had tried repeatedly with type: and type:= to no avail, only the tilde ~ worked.

Hope this helps someone.

3
  • Does this work for partial matches, and is it case-sensitive? For example, do I have to use "Microsoft Word Document", or is "word doc" going to be adequate (assuming that I don't have another application that calls itself "«something» Word") Jan 31, 2019 at 12:12
  • In any search I've done anywhere the tilde has always meant partial match search or similar, so I'm going to say yes. Feb 1, 2019 at 13:43
  • In spite of the time lapse, I've rechecked this, and I need explicit wildcards to match on the "type name" - that is, if I want to match Word documents (and I don't have something other than MSWord that calls itself "Word"), I need to use type:~"*Word*" Jun 17, 2022 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .