I'm running GNU Emacs on Windows 7 and was just wondering how to set up emacs so the "find-name-dired" command works. When I try using find-name-dired to recursively search for files I get this:

find . "(" -iname "*.tex" ")" -exec ls -ld {} ";"
File not found - "*.tex"  
find exited abnormally with code 2 at Thu Feb 26 16:58:31
  • 1
    I'm pretty sure find is part of the GNU findutils, which is generally runs on GNU systems (i.e. not Windows). You may need to look into Cygwin/MSYS.
    – PythonNut
    Feb 27 '15 at 1:15
  • I have added cygwin to the beginning of my path and I still get this error.
    – bkmoney
    Feb 27 '15 at 1:27
  • When using GNU’s find program on Windows should be favored using executable-find% to checkout GNU’s find over Windows builtin find program. See github.com/junjiemars/.emacs.d/blob/master/config/…
    – 南山竹
    Jul 24 '18 at 6:26

I'll add this solution here as modifying the PATH can have unwanted side effects elsewhere. To set the find program to the wanted find.exe, for example provided by git:

(setq find-program "c:/Git/usr/bin/find.exe")
  • I needed to do (setq find-program "C:\\Users\\rnwol\\scoop\\shims\\find.exe") Nov 6 '19 at 12:20

Emacs relies on various Unix tools, including find. On Windows you can install a Unix-style shell such as Cygwin, or just install ports of the specific tools you need. There are several options - I'm currently using tools from ezwinports.

Whatever you choose, you'll need to make sure that the Unix find command is on the path ahead of Windows one. You can do that with environment variables before starting emacs, or add to the emacs exec-path.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.