Monday, 28 January 2019

How to search only the filename for a substring in Windows?


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?


zip
has zip
zip.doc
azip.zipx
textzip.txt
has zip text
File.zip.txt
zipper.winzip
File - zip text.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.


noname
File.xzip
File.zipx
File.azipx
File.bxzip
File name.zip

Answer



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?


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...