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

Solution 1:

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.

Solution 2:

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".

Solution 3:

  • Press Ctrl + Shift + F

    enter image description here

  • Click on 3 dots under search box.

  • Type your query in search box

  • Type ./FOLDERNAME in files to include box and click Enter

Alternative way to this is, Right click on folder and select Find in Folder