Exclude all children of dir that contains filename

Discussion related to "Everything" 1.5 Alpha.
Post Reply
jorn
Posts: 5
Joined: Mon Mar 27, 2023 8:58 am

Exclude all children of dir that contains filename

Post by jorn »

Here's the query I'm using to get the paths of all directories containing a filename starting with ".discarded":

Code: Select all

regex:"^.exclude.*" column1:=(path:) columns:column1;name;path;size sort:column1-descending
To put it simply, I want to:
- Identify directories containing any file that matches the pattern (as the query above does).
- Use the results to exclude all descendant (within these directories) in a subsequent search.

Is that possible? Any guidance on how to achieve (this or suggestions for alternative approaches) would be greatly appreciated! :geek:
void
Developer
Posts: 16740
Joined: Fri Oct 16, 2009 11:31 pm

Re: Exclude all children of dir that contains filename

Post by void »

Please try the following:
  • Search for:
    regex:child:^\.exclude
    ( \. = match a literal . )
  • Select all results. (Ctrl + A)
  • Copy all filenames. (Ctrl + Shift + C)
  • Change your search to:
    !ancestorfilelist1:
  • Right click the ancestorfilelist1: text in the search box and click Edit File List Slot...
  • Paste your filenames and click OK.
    -If you want to exclude the parent folder too, search for: !ancestorfilelist1: !filelist1:
File List Slots
jorn
Posts: 5
Joined: Mon Mar 27, 2023 8:58 am

Re: Exclude all children of dir that contains filename

Post by jorn »

I did a terrible job at phrasing my question correctly :oops:

I'm basically looking for a way to exclude all directories (including sufolders/children) containing a specific file (e.g. ".gitignore"), from a single search-query (within the application).


E.g. given the following filestructure:

Code: Select all

└── some_dirname
    ├── poetry.lock
    ├── pyproject.toml
    │
    ├── other_dirname
    │   ├── .exclude
    │   ├── labels.yml
    │   ├── release-drafter.yml
    │   └── workflows
    │       └── tests.yml
    │
    ├── src
    │   └── hypermodern_python
    │       ├── __init__.py
    │       ├── __main__.py
    │       └── py.typed
    │
    └── tests
        ├── __init__.py
        └── test_main.py
It should exclude everything within 'other_dirname'
void
Developer
Posts: 16740
Joined: Fri Oct 16, 2009 11:31 pm

Re: Exclude all children of dir that contains filename

Post by void »

Everything doesn't have the option to do a single pass search to exclude these folders.

I'll look into adding something as this is requested often enough.
ancestor-child: ? -not sure of the terminology..



For now, please consider omit results:
  • From the Index menu, check Enable Omit Results.
  • Search for:
    regex:child:^\.gitignore
  • Select all these folders.
  • From the File menu, click Omit.
Post Reply