How to Ignore Generated Files in IntelliJ's Find in Files (Search Bar)

I recently needed a way to ignore, or exclude, generated and build files from IntelliJ’s Find in Files function.

In particular, I only wanted to search relevant source and configuration files (e.g. src files, pom.xml, etc.).

To ignore generated files, we need to create a Custom Scope.

1. Open Find in Files

First, let’s open Find in Files.

  • On Windows: CTRL + SHIFT + F
  • On Mac: COMMAND + SHIFT + F

We can also go to EditFindFind in Files... to open the dialog.

2. Open up Scope Tab

In the Find in Files dialog, navigate to the Scope tab.

Select the ellipsis (three dots) icon: ....

This should open up another modal window.

3. Create a custom scope

Click on the plus icon (+) and create a Local scope.

We can name our scope Exclude generated files.

We want to ignore searching all files in our target directory, which contains the compiled version of our source.

In the Pattern input box, let’s place the following:


This means that our Find in Files search will only search files not in the target folder.

3.1. Add more conditions to narrow scope

Suppose we also want to avoid searching Library Classes.

We can append to our pattern using boolean operators.


Let’s also ignore External Dependencies.


Once we’re done editing our scope, remember to click Apply and OK.

4. Use scope in Find in Files

Now, in the Scope tab of Find in Files, click the dropdown and select the scope we created earlier.

My scope says Exclude generated files, and all searches under this scope will ignore compiled, build files.