When I search with find-grep-dired it also searches /Library/ directory and finds hundreds of cached links. Is there a way to ignore /Library/ directory?

I found this :

M-x customize-option

But it didn't work for me. Is grep-find-ignored-directories depracated?

I will remove my documents file from the root directory eventually so I don't have to search the entire disc but a solution now would be helpful.

1 Answer 1


If you use library find-dired+.el (see also Locate Files Anywhere), then you can exclude any number of paths, and you can limit the depth.

find-grep-dired is an interactive compiled Lisp function in find-dired+.el.

It is bound to menu-bar search find find-grep-dired, menu-bar subdir find find-grep-dired.

(find-grep-dired DIR REGEXP &optional DEPTH-LIMITS EXCLUDED-PATHS)

Use Dired on the list of files in DIR whose contents match REGEXP.

The find command run (after changing into DIR) is essentially this, where LS-SWITCHES is (car find-ls-option):

find . \( -type f -exec grep grep-program find-grep-options \
     -e REGEXP {} \; \) LS-SWITCHES

Thus REGEXP can also contain additional grep options.

Optional arg DEPTH-LIMITS is a list (MIN-DEPTH MAX-DEPTH) of the minimum and maximum depths. If nil, search directory tree under DIR.

**Optional arg EXCLUDED-PATHS is a list of strings that match paths to exclude from the search. If nil, search all directories.

When both optional args are non-nil, the find command run is this:

find .
     -mindepth MIN-DEPTH -maxdepth MAX-DEPTH
     \( -path EXCLUDE1 -o -path EXCLUDE2 ... \)
     -prune -o -exec grep-program find-grep-options -e REGEXP {} \;

where EXCLUDE1, EXCLUDE2... are the EXCLUDED-PATHS, but shell-quoted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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