I'm trying to find file recursively from default-directory with helm-find (C-x c /). It works out of box in linux.

I tried setting find-program like (I have git bash installed)

(setq find-program "c:/Program\ Files/Git/usr/bin/find.exe")

It didn't work.

Then I tried installing findutils (gnu find) from chocolatey and then tried.

(setq find-program "C:/ProgramData/chocolatey/bin/find.exe")

This did not work either. What am I doing wrong?

  • Find works after setting the shell to git bash. Jul 18 '20 at 2:23

The problem is that helm-find uses find-cmd.el. This find-cmd function generates a GNU find style command that runs without issues on bash, but fails to run on powershell. The default shell in Emacs is PowerShell. If you set your default shell to Git bash (You can follow the steps in this answer to do that.), then it works.

Some Elisp script to do that:

(prefer-coding-system 'utf-8-unix)
(setq shell-file-name "C:\\Program Files\\Git\\usr\\bin\\bash.exe")
(setq explicit-bash.exe-args '("--login" "-i"))
(setq find-program "C:/ProgramData/chocolatey/bin/find.exe")

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.