Tip: Use Windows Explorer "Save Search" feature with quoted searches
Thursday, March 13, 2008 at 1:40 pm Posted by tslavens
(3 messages posted)
Hope this helps someone,
In Windows Explorer, you can save a set of search criteria for repeated use as
described in this
article. The problem is that if there are double quotes in the search term (e.g.
for files with spaces, or to limit results), the Save Search feature under
the File menu doesn't do anything, at least not on Win2000 SP4 and WinXP-32
SP2, and there is no error message. I haven't tested for the problem or the workaround
on other platforms. I suspect the workaround would apply to Win2003 and WinXP-64
if this problem occurs there; no bets on WinVista.
Workaround: Create a search where the quotes are replaced with an obvious letter,
save the search, then manually edit the saved binary .fnd file. This workaround
assumes you're only searching for files with ASCII characters, not Unicode characters
(should be fine for users in most Western locales).
Tools: You'll need either a binary file editor, or a text editor which is capable
of editing binary files. I chose the latter, specifically SciTE
because it's already on all my systems. In particular, Windows Notepad will not
work.
Step-by-step instructions by example using SciTE (adjust as needed if you're using
another tool):
- In Windows Explorer, search for your files using quotes; in my case, I wanted
to search for the folders "_svn" ".svn"
- Inspect the results to be sure that your search is correct, and that it starts
from the correct folder
- Now replace every double quote with a single character which
you can easily spot; in my case, I chose capital "Z", so my changed search was Z_svnZ
Z.svnZ
- In order to save the changed search, you must run it at least once, even though
it's not for the files you want; ignore the results (probably no files at all); if
the search takes a long time, you may stop it before it finishes and still save it
- Save the search, giving it a useful name, and noting where you saved the file,
which will end in .fnd; if you don't have experience editing binary files, you might
want to make a copy of the saved file so you can easily start over if needed
- Open the saved .fnd file in SciTE; AFAICT, the search term is stored in two places
in the file, once as plain ASCII and once as Unicode; inspect the file for the ASCII
instance, which is easier to see and appears before the Unicode instance
- Replace the "Z"s (or whatever you chose) with double quotes
- To find the Unicode instance, look for your search term where every character
is interspersed with a single NULL byte; SciTE represents NULL bytes as a black box
with NUL in white letters; your tool may represent them differently; once
you've found the Unicode search term, replace the "Z"s with quotes, leaving the NULL
bytes alone
- There might be "Z"s (or whatever character you chose) elsewhere in the .fnd file;
leave them alone; only replace the "Z"s which are part of the two instances of your
search term
- Save the .fnd file and test it by right-clicking on it in Explorer and choosing
Open; note that you still have to click the Search Now button in Explorer;
the .fnd file doesn't automatically run a search, it just sets it up
In practice, this workaround is much faster than the time it takes to read through
the steps above. Once you've done it a couple of times, it's very easy.
FYI, Bruce Dodson has created a nicely done SciTE installer for Windows. As he
only updates it for his own needs, it sometimes lags the current version of SciTE,
but he's been gracious enough to publish it for anyone to download. http://gisdeveloper.tripod.com/scite.html
Sorry I didn't link it; that's to discourage looky-loos from eating up Bruce's bandwidth.
- Tom
[Reply or follow-up to this message]
|