smilyface
smilyface

Reputation: 5521

Intellij find string in files but not in file/path

I was searching to get a keymap or any option in IntelliJ to search a string in files but "not in" some files.


For example :
Search string : abcd
Search in : Module1
Search NOT in : Module1/path1/x/folder2/, Module1/path2/y/folder1/


Any idea to get this done ?

Upvotes: 1

Views: 373

Answers (1)

Bohuslav Burghardt
Bohuslav Burghardt

Reputation: 34816

  1. Open the Search in Path dialog (CTRL+SHIFT+F)
  2. Select custom scope and click the ... button next to it
  3. You can create new scope (green plus icon) in the dialog that is shown by including and excluding files/directories to search
  4. Click OK when you're done
  5. Now you can search using this scope and you can use it for future searches

For instance this screenshot shows custom scope for searching only in com.company package:

enter image description here

More information on scopes is in IntelliJ help.

Upvotes: 1

Related Questions