Visual Studio - Find in files > not any node_modules folders

6.6k views Asked by At

So in Visual Studios you can "Find in files" a string - I find this very useful to locate a file in which some markup or JS may be found, I use VS for my main code editor for Web development.

The problem is, most of my projects use node.js and node based build tools grunt/gulp etc. so I have a node_modules folder somewhere in my project that makes the FIND take for ever as there are thousands of files!!

How can I search in files and folders for a string BUT not in a node_modules directory.

In SublimeText2 you can remove a folder from the project without deleting it, this will stop a search looking in there...

A RegExp will be for the string not the filePath :(

2

There are 2 answers

1
alergy On BEST ANSWER

Ok so I've tried this and it seems to work.

You can hide the node_modules folder (if they have a common root), by setting the Hidden attribute on the folder. As you say it fulfils your needs as per the question.

0
Zephyr was a Friend of Mine On

2020 Version

Add the following exclusion

!*\node_modules\*;!*\bin\*;!*\obj\*;!*\.*

enter image description here