The Emacs commands rgrep
, grep-find
and find-grep-dired
are all different interfaces for
grepping recursively into subdirectories. By default, they use the
command find
to determine which files to work on, and either
run grep
directly from find, or use xargs
to batch
up files and reduce the number of invocations of grep
.
Windows also comes with a find
command, but it is not in any
way compatible with the POSIX find
that Emacs tries to use.
Emacs expects a find
compatible with GNU findutils.
See Other useful ports. After you have installed it, you will need
to make sure that Emacs finds this version, not the standard Windows
find
command. You can do this by either renaming the
Windows command, changing your PATH
to ensure that the directory
containing the findutils bin directory comes before the Windows
system directory, or set the variable find-program
to the full
path to the findutils find
command.
An alternative if you have a recent version of grep is to customize
grep-find-command
to use ‘grep -r’ instead of both find
and grep. Another alternative if you don’t need the full capabilities
of grep is to use ‘findstr /n /r’; add the ‘/s’ option if
you want a recursive search.