I found solution.
From documentation:
Consult splits the input string into two parts, if the first character
is a punctuation character, like #.
For example #grep-regexps#filter-string, is split at the second #. The
string grep-regexps is passed to Grep. If you enter multiple regular
expressions separated by space only lines matching all regular
expressions are shown. In order to match space literally, escape the
space with a backslash. The filter-string is passed to the fast Emacs
filtering to further narrow down the list of matches
.
consult-find, consult-locate: Find file by matching the path against a
regexp. Like for =consult-grep,= either the project root or the
current directory is the root directory for the search. The input
string is treated similarly to consult-grep, where the first part is
passed to find, and the second part is used for Emacs filtering.
So in my case:
#target#target$
And here result:
And now its find target
folders.
Thanks for @NickD the problem with this approach is that it also find file with name target.
So I use another approach. I create my custom function (change value of variable consult-find-args
):
(defun consult-find-dir ()
"Search for regexp with find only DIR in DIR with INITIAL input."
(interactive)
(setq consult-find-args "find . -type d -not ( -wholename */.* -prune )")
(consult-find)
)
This is better written as follows, with consult-find-args
let-bound to the desired value:
(defun consult-find-dir ()
"Search for regexp with find only DIR in DIR with INITIAL input."
(interactive)
(let ((consult-find-args "find . -type d -not ( -wholename */.* -prune )"))
(consult-find))
Here result:
M-x consult-find-dir
target#target$

And now it found ONLY folder target

consult-find
use the Unix toolfind
underneath? If so, you can try to figure out how to pass to the underlyingfind
a-type d
option to select only directories.