Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude a folder name from Eclipse file search

Tags:

java

eclipse

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?

like image 658
triad Avatar asked Feb 28 '12 22:02

triad


3 Answers

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.

like image 149
Kevin K Avatar answered Oct 17 '22 03:10

Kevin K


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.
like image 43
triad Avatar answered Oct 17 '22 03:10

triad


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.

like image 23
E-Riz Avatar answered Oct 17 '22 02:10

E-Riz