Feb 8, 2012

Searching by Filename ONLY in Windows 7

File indexing under Windows 7 still has some problems especially with my version control and online backup systems. I've had to turn off indexing for all the files in my development tree. However, I still need to find files there. Also sometimes doing a search on file contents just returns way too many hits. I would hope there's an easier way but until I discover that simple method for this common task…

UPDATE 10/2014 – I found the simpler, better way.


Keywords to the rescue

imageHit the Window's Key and F to quickly pop open a new blank window for searching. In the upper right hand corner you can type your search criteria. Using the keyword System.FileName: as a prefix will limit your searches to filenames and folder names.  Don't forget the colon at the end. You can then use any one of a number of characters to specify a search operator. For example when using the  filename keyword you can specify a starts with, contains, or exact operator. In the example you can see I used "~=" which I assume was chosen because it roughly translates to, "approximately equals". This is used  to find any files that "contain" the text I then put in quotes.  Using just an "=" will give you an exact match, "~<" will give a starts with "~>" will give an ends with but you'll have to specify the file suffix. That is, if you want a PDF file whose name ends in "syncor" you write System.FileName:~>"syncor.pdf".

There are of course keywords other that System.FileName, here are some sample searches

  • System.Size:>100mb
  • System.Keywords:"coders"
  • System.Author:~!"Tod"  -- any author that doesn't contain Tod in their name 
  • System.Kind:<> picture – <> means "is not" – good luck figuring out the "kind".
  • System.DateModified:2013 – to find files that survived the Mayan apocalypse

In the Windows Help try searching for "Advanced Tips"  and read the Advanced tips for searching in Windows.

image You can also use the Folder Options control panel to modify how search works, including turning on Use natural language search, but odds are good that will just start returning too many matches again.




About Me

My photo
Tod Gentille (@todgentille) is now a Curriculum Director for Pluralsight. He's been programming professionally since well before you were born and was a software consultant for most of his career. He's also a father, husband, drummer, and windsurfer. He wants to be a guitar player but he just hasn't got the chops for it.