10

I found the question and answer Eclipse :: Hide .svn files in Open Resource dialog but don't want to filter all resources with a given name say 'work', which is too general. I only want to exclude the work folder in one specific subfolder 'sub'. I see the "File and Folder Attributes" options "Project Relative Path" and "Location", but none of them works with somethink like:

sub/work

Any ideas how to get the resource filter to work in a certain subpath only?

jan
  • 2,741
  • 4
  • 35
  • 56
  • Very closely related: [Completely exclude certain directories from Eclipse CDT project](https://stackoverflow.com/questions/7498878/completely-exclude-certain-directories-from-eclipse-cdt-project) – Gabriel Staples Dec 06 '21 at 21:33
  • Also very closely related (my own Q&A I just added): [How to exclude all parts of a folder in Eclipse except for a few specific sub-folders within it](https://stackoverflow.com/q/70267494/4561887) – Gabriel Staples Dec 08 '21 at 00:12

2 Answers2

16

Found a solution with the settings:

  • Applies to: Files and folders
  • All children (recursive) activated
  • File and Folder Attributes:
    Project Relative Path matches "sub/work"

Now all subfiles and subdirectories below this are excluded.

jan
  • 2,741
  • 4
  • 35
  • 56
  • 4
    "Applies to: Folders" works too. All children (recursive) activated is the important part... – jan May 15 '13 at 09:50
  • See also my answer here for a *ton* more detail: [How to exclude all parts of a folder in Eclipse except for a few specific sub-folders within it](https://stackoverflow.com/a/70267495/4561887) – Gabriel Staples Dec 08 '21 at 00:10
10

Beware trailing slashes when you want to filter out an entire folder, ie. use

path/to/exclude

not

path/to/exclude/
JobJob
  • 3,822
  • 3
  • 33
  • 34
  • 1
    Yes this is true, however for this question the "All children (recursive)" option seems to be the important part. Maybe this is just naming, i.e. there ain't really a recursion. If I exclude a folder of course all children shall be excluded too. So the real question probably is "Does anythink happen if I want to exclude a folder without activating this option?"... – jan May 15 '13 at 09:48
  • 2
    And not /path/to/exclude, which is the mistake I made. – NobleUplift Oct 15 '15 at 15:19
  • I had to use `*/path/to/exclude` when I used externally located source. – Mikko Rantalainen Oct 04 '16 at 06:28
  • I also noticed this behavior and noted it in my answer here: [How to exclude all parts of a folder in Eclipse except for a few specific sub-folders within it](https://stackoverflow.com/a/70267495/4561887) – Gabriel Staples Dec 08 '21 at 00:10