right click directory > mark directory as excluded... If you want to add or remove files from that directory reverse the process... cancel exclusion on the directory, get/put files... mark as excluded again.
In the Find in Files dialog, select the File Mask checkbox and from the list of file types, select the one you need. IntelliJ IDEA limits its search to the specified type. If you don't find the file type you need in the list, enter your file type in the File Mask field.
You can also just right click on your folder and select Mark Directory As > Excluded . Excluded folders (shown as rootExcluded) are ones that IntelliJ IDEA "partially ignores".
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
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:
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.
Examples of Patterns for Pattern
field:
!file:*.css
- exclude CSS filesfile[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!
This would exclude all js, css and twig for example:
!*.js, !*.css, !*.twig
If you are like me that don't want to use the File Mask option or create a custom scope, etc. but just wanted to be able to add it to project settings one time and be done with it, then here's a solution for you.
I wanted my Find in Path to not search in lock
files (auto-generated manifest file by package managers), here's what I had to do for that:
Goto File >> Project Structure (or just press Command+;)
Select Modules under Project Settings
Add a pattern or file names to the Exclude files text-box, in this case: *.lock;package-lock.json
and hit Apply, and then ok.
Note The above option is available in IntelliJ 2019 and versions after that, not sure about older versions. For more info, https://www.jetbrains.com/help/phpstorm/excluding-files-from-project.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With