Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search for text in all files in a directory?

Is there a way to search for text in all files in a directory using VS Code?

I.e., if I type find this in my search, it will search through all the files in the current directory and return the files that matched.

like image 208
user2465134 Avatar asked Jul 25 '16 16:07

user2465134


People also ask

How do you search for a word in all files in a directory?

Search All Files in Directory To search all files in the current directory, use an asterisk instead of a filename at the end of a grep command.

How do I search for text in a directory?

If you'd like to always search within file contents for a specific folder, navigate to that folder in File Explorer and open the “Folder and Search Options.” On the “Search” tab, select the “Always search file names and contents” option.


2 Answers

You can do Edit, Find in Files (or Ctrl+Shift+F - default key binding, Cmd+Shift+F on MacOS) to search the Currently open Folder.

There is an ellipsis on the dialog where you can include/exclude files, and options in the search box for matching case/word and using Regex.

like image 118
3 revs, 3 users 50% Avatar answered Dec 04 '22 11:12

3 revs, 3 users 50%


In VS Code...

  1. Go to Explorer (Ctrl + Shift + E)
  2. Right click on your favorite folder
  3. Select "Find in folder" (Alt + Shift + F)

The search query will be prefilled with the path under "files to include".

like image 25
Jesper Wilfing Avatar answered Dec 04 '22 11:12

Jesper Wilfing