So I have a folder which has a bunch of files (source code) and other folders. I want to search this folder for a word, say, faceGroup, and get all the files that contain this word and also get locations of these files. How to perform this action effectively and efficiently (maybe using terminal or spotlight)?
Asked
Active
Viewed 5,975 times
-1
-
1`grep -R -l directoryName word` – Barmar Jun 22 '18 at 22:27
-
Also you may try with `find` [How do I find a file by filename in Mac OSX terminal?](https://superuser.com/a/226571) – Xarvalus Jun 22 '18 at 22:28
-
1Open the folder in Finder, type Cmd-f, then enter the word you want to search for. – Barmar Jun 22 '18 at 22:35
-
@Barmar Doesn't seem to work. To test, I typed `grep -R -l . scan` and it returned `grep: scan: No such file or directory`. The word `scan` does exist in a file in this directory. – OneFlowerOneWorld Jun 22 '18 at 22:45
-
1Oops, got the order wrong. `grep -R -l word directoryName` – Barmar Jun 22 '18 at 22:48
-
You have a folder and some other folders. Where do you want to search exactly? In the first folder or the others? Or both? How did you get folders on a Mac - they are a Microsoft invention - Macs have directories. – Mark Setchell Jun 24 '18 at 21:31
2 Answers
0
You can use the 3rd party app EasyFind. It will search in files and folders and list where all matches occur. You can also narrow your search to a specific disk or folder. EasyFind is free and available from the app store.

Natsfan
- 4,093
- 3
- 22
- 29
0
You can use this command to search folder.
mdfind kind:folder "Huddl-Backend"

Ankit Kumar Rajpoot
- 5,188
- 2
- 38
- 32