How to exclude a file extension from IntelliJ IDEA search?

You can create custom scope there: In 'Find in Path' dialog you can check radio button 'Custom' and open scopes window. There you can customize path and search pattern.

enter image description here

Examples of Patterns for Pattern field:

  • !file:*.css - exclude CSS files
  • file[MyMod]:src/main/java/com/example/my_package//* - include files from the directory in a project.
  • src[MyMod]:com.example.my_package..* - recursively include all files in a package.
  • file:*.js||file:*.coffee - include all JavaScript and CoffeeScript files.
  • file:*js&&!file:*.min.* - include all JavaScript files except those that were generated through minification, which is indicated by the min extension.

Or check the official documentation.

Good luck!


In intellij 16 there is a section "File name Filter" to exclude an extension use !*.java. You can give more detailed patterns as well for example I use the pattern below to only return .java files except those with a name starting or ending with test. Pattern: !*test.java,*.java,!Test*.java

enter image description here

In recent versions of Intellij the GUI has been updated a bit but the same still applies see the "File mask" on the top right hand corner see image below:

enter image description here


In "Find in Path" and "Find in Files" (Ctrl+Shift+F) you can use the "File mask" input.

For example, this would exclude all js, css and twig:

!*.js, !*.css, !*.twig

PhpStorm File Masks for Find in Path

It's handy cause it also keeps a list of previous inputs, but it gets messy easily when you add a lot of extensions. If it gets too crowded, consider excluding some folders as well (right-click -> "Mark directory as" -> "Excluded")