Is there a way to find and replace a text string automatically in all folder's files?
2 Answers
Yes, there is Multiple Files search and replace.
Press Ctrl + Shift + F (Cmd + shift + F on macOS):
In the Where field, you can also add filters to search only folders and files that you need. If nothing is set, the search is made on all files listed in the sidebar.
If you double-click on a line of the search result, Sublime Text will jump to that line.
Notice these icons in the search bar:
The first (show context) toggles the context in the result format (if enabled, some lines of text are shown before and after the matching line). The second allows to show the result in a new buffer, or in a console.

- 30,738
- 21
- 105
- 131

- 20,218
- 7
- 70
- 53
-
3Is there a way to control which of the found cases in "Find in Files" get replaced? The Replace button does Replace_All. – George Shaw Jan 07 '13 at 22:40
-
I think that the only way is to use multiple files search to get the files you need to modify and then use normal search and replace (cmd+alt+F), file by file. – Riccardo Marotti Jan 08 '13 at 08:44
-
I don't pretend to know more than the creator of ST himself but you could just close the files (middle mouse click or ctrl+w) where you don't need the changes done and then click replace. Afterwards you can use Ctrl+Shift+t to reopen the closed files. You could also "add a exclude filter" clicking the button in the middle (the ellipsis) and write down the files where you don't want replacements. – Ivan Castellanos Apr 15 '13 at 02:07
-
7If you put `
` in the "Where" field, it'll search recursively through all of the folders and files in the currently open project. You can also type in a relative path (e.g., `search/for/things/here/` and it will only search through that folder, recursively, relative to your project's root. Very handy. – jeffbyrnes Jun 21 '13 at 17:12 -
2For this where field to come up by default with search and replace (ctrl+H) I added this to my user keybindings: `{ "keys": ["ctrl+h"], "command": "show_panel", "args": {"panel": "find_in_files"} }` – reflexiv Jul 09 '13 at 22:00
-
Is there a way to use this whilst ignoring the word your searching for if its in a comment ? – sam Jan 17 '14 at 17:24
-
@RiccardoMarotti Hi~, when in sublime text 3, `cmd` + `shift` + `F` only show `FInd:` and `Where:`, without `Replace:` ,what do I do ? – Littlee Dec 01 '16 at 08:05
-
Is this a Menu item? While I ultimately use the short-cut, I look at the Menu item to figure out what the short cut keys are. All I see in my Build "4107" is the basic Replace. – granadaCoder Aug 13 '21 at 12:59
Press Ctrl + Shift + F (Cmd + Shift + F on Mac OS X) and then put *.*
in the Where: field.
This will open the search up to all files in the project as opposed to only open files or folders.
You can also use this to search only files of a certain type, or with a certain name regardless of type. It's just wildcards for the filename and extension.

- 30,738
- 21
- 105
- 131

- 1,748
- 2
- 20
- 33