[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: searching files without extensions



Reply to note from Harry Binswanger  Mon, 06 Dec
2010 16:13:43 -0800

> A simple solution for your search problem is to get Locate32,

You might also explore FINDSTR.EXE, the grep utility that comes with
Windows. Powerful, lots of options, and no indexing required. A
simple batch file can focus the search on files with no extensions
or any other filemask. Here's an example, NoExt.bat, that searches
for a case-insensitive string in files without extensions and in
.txt files, recursing through all subdirectories. (If you want to
broaden the search to include other extensions, insert lines modeled
on the line with "*.txt" directly beneath that line; see the
:: commented-out line with "*.xyz".) To use the batch file, ChDir to
the desired directory and command:

NOEXT.BAT "string"

:: NoExt.bat
@echo off
if ""%1=="" goto a
echo Working...
dir/b/a-d/s * | find/v "." > noext.tmp
dir/b/a-d/s *.txt >> noext.tmp
:: dir/b/a-d/s *.xyz >> noext.tmp
cls
findstr.exe /iln /f:noext.tmp /c:%1 | more
del noext.tmp
goto :eof
:a
echo.
echo NoExt.bat
echo Find strings in files without extensions and in .txt files
echo Searches case-insensitively, reports line numbers and
echo recurses through subdirs
echo.
echo Syntax: NoExt.bat "string"
goto :eof
:: end

Hope this helps.

--
Carl Distefano
cld@xxxxxxxx