triad
triad

Reputation: 21507

Exclude a folder name from Eclipse file search

How do I exclude a certain folder name from the Eclipse file search (CTRL + H)? For example if I want to search all files, but exclude any files in a folder called FolderName (and its subdirectories), what can I enter in the file name pattern to accomplish this?

Upvotes: 6

Views: 6774

Answers (3)

triad
triad

Reputation: 21507

After more digging, I found yet another workaround which might be helpful for anyone with this same issue.

  • Project > Properties > Resource > Resource Filter
  • Add
    • In Filter type, check "Exclude all"
    • In Applies to, check "Folders" and "All children (recursive)"
    • File and Folder Attributes, select "Name" "matches" and enter the folder name you want to exclude in the text field.

Upvotes: 12

E-Riz
E-Riz

Reputation: 32914

You can define a Working Set that includes just the directories you want to search. In the File Search dialog, select Working Set in the Scope section (at the bottom), then Choose..., then use New... to define your Working Set.

Upvotes: 4

Kevin K
Kevin K

Reputation: 9584

I have a couple options for you.

First Option

If it is feasible, select the range of folders you want to search, then Ctrl - click any folders you want to exclude from the search. Press Ctrl - H to open file search, then under Scope choose the Selected Resources option.

Second Option

Right-click the folder to exclude, select properties, check Derived, and apply. This works because by default File Search will exclude derived resources. After the search you can undo the Derived setting.

Note that I'm not familiar enough with the inner workings of Eclipse to be certain about potential side effects of temporarily marking files as derived like this, but I suspect it should be okay.

Upvotes: 12

Related Questions