Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Following on from this question, I'd like to know whether Windows Search also shares the same shortcomings, or whether it is possible using Advanced Query Syntax to search for a substring in the filename only, leaving out the extension?

What I mean is, is it possible to search for something like, say, "zip" in only the filename such that the following valid filenames are returned?

has zip
has zip text
File - zip
this file name haszipin it.txt

The following are invalid filenames since they do not contain the string "zip" in the filename portion, but only in the extension. These should be excluded.

share|improve this question
use Everything and regexp. – Shiki Dec 3 '12 at 23:26
@Karan, do you mean in the find box of Explorer? I gave up using that (in Vista+) a long time ago because it is just horrible to use. Just today, I was trying to find all localization files (e.g., *fr_fr*, *es_es*, etc.) and could not get it to work no matter what combinations and permutations I tried. – Synetech Dec 3 '12 at 23:26
@Shiki: Note that I mentioned Windows Search and AQS specifically. This question is not about looking for alternatives - I have plenty of those, thanks. – Karan Dec 3 '12 at 23:28
@Synetech: Yes, that's what I'm talking about. file:zip or filename:zip seems to look in exensions as well, just like dir, so I'm wondering if there's any way at all to overcome this, perhaps by excluding ext: somehow. – Karan Dec 3 '12 at 23:30
"How to ...?" is grammatically incorrect. – artistoex May 27 '13 at 9:32
up vote 3 down vote accepted

You could exclude zip files from the index but I know that isn't really answering your question. I use a freeware program called Everything that lets me choose what files to index and you can use regular expressions in that search in order to get more exact results (like what you're looking for). As far as I'm aware, windows search doesn't allow regular expressions but maybe you can attach a second parameter to the search like *zip*.* && not *.zip Not sure if that's possible though.

Edit: Since I (Karan) just tweaked Codezilla's last attempt posted in chat, it wouldn't be proper to add it as a separate answer. All credit goes to him (Edit: and to Scott as well) for discovering 95% of this search term, which seems to correctly identify the 10 valid filenames and leave out the 6 invalid ones:

*zip* NOT "*.*zip*" OR filename:"*zip*.*zip*"

So it can be done, but not without jumping through hoops. Confirmation of the fact that Windows Search sucks. Couldn't they have simply added proper RegEx support?

share|improve this answer
Yeah, you can see my comment above about alternate tools. As for AQS itself, I've tried but seems it searches for the substring in the extension as well for some reason. I need a way to restrict the search to file: or filename: and exclude ext:. I tried using NOT, but couldn't get it to work properly, so I'm hoping someone can help. – Karan Dec 3 '12 at 23:33
does *zip*.* -*.zip not work? – Codezilla Dec 3 '12 at 23:38
Think maybe I figured it out, try: *zip*.* -"*.zip" You have to use quotes to get it to look at it seriously apparently. This is probably the case with a lot of results you may be getting that aren't what you expect. Er, well, this just finds the solution to the zip problem but I think you mean globally excuse all extensions or something? – Codezilla Dec 3 '12 at 23:41
Nope, any single substring will do. Unfortunately, *zip*.* -"*.zip" seems to also return File.azipx, File.bxzip, File.xzip, File.zipx etc. (see my valid and invalid filenames list above). – Karan Dec 4 '12 at 0:09
Doesn’t the last term need to be "*zip*.*zip*"? Does the expression you have now catch azip.zipx or zipper.winzip? – Scott Dec 4 '12 at 23:52

filename:*zip*. (note the . at the end) seems to work fairly well on Window 7 — equivalent to filename:*zip*.* — except it doesn’t find files with no extension.

For example, I created a new folder and created these empty files:

                                enter image description here

(Look familiar?)  The display is sorted by modification date to preserve the order.  Then I typed filename:*zip*. into the Search box, and I got

enter image description here

i.e., all the files that have zip in the file name (exclusive of the extension) and have a (non-null) extension.

share|improve this answer
filename:*zip*.* seems to return the exact same files as filename:*zip*. and filename:*zip*, and these include files with "zip" in the extension but not the filename. – Karan Dec 4 '12 at 0:01
Hi, just saw your edit. I don't know what to say really. On Windows 7 x64 I created a brand new folder just now (so it is unindexed), created 14 0-byte files with those exact same names, then copy-pasted your search string i.e. filename:*zip*. and it returned 13 names as results out of the 14, with only noname excluded. :( Will look into this again when I get back from work, but there clearly seems to be a major discrepancy here. (Oh, and I haven't modified any advanced file type indexing options on this system either.) – Karan Dec 4 '12 at 0:51
I am shocked — shocked! — to learn that Windows behaves inconsistently. – Scott Dec 4 '12 at 0:58
Hi, I checked again on a different Windows 7 Home Premium x86 PC (previous one was Ultimate x64), and it behaves the same way (1 filtered, 13/14 displayed). So at least it seems to behave consistently on the two machines I've tried so far. – Karan Dec 4 '12 at 15:17

You must log in to answer this question.

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