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?
- Explorer, batch, or PowerShell solutions are acceptable.
- The ideal solution will work for both Windows 7 and Windows 10, but separate solutions for Windows 7 and Windows 10 are also acceptable.
- I would prefer not having to analyze and use explicit file extensions in the search.
2 Answers
A few things about Windows and the search function in the File Explorer:
- Windows doesn't know about mime-types such as "JPEG Image" or "Markdown file" (or their respective (sub-/super-)types
- 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
.mdfiles 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:
6To 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.
2