How to Ommit Appdata folder but include one folder inside Appdata?

Discussion related to "Everything" 1.5 Alpha.
Post Reply
hellen_dorandt89
Posts: 52
Joined: Sun Apr 03, 2022 5:52 pm

How to Ommit Appdata folder but include one folder inside Appdata?

Post by hellen_dorandt89 »

I have the entire Appdata folder in my ommit list as it mostly just adds noise to my index but there is this one folder in Appdata I need to see.
The folder is:

Code: Select all

C:\Users\User1\AppData\Local\Lazy Nezumi Pro\presets

How Can I go about making an acception for this folder to be shown in my search result while still ommiting the entire Appdata folder? Thanks!
void
Developer
Posts: 16756
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to Ommit Appdata folder but include one folder inside Appdata?

Post by void »

This can be done with a negative look-ahead regex filter:

In Everything 1.5, from the Index menu, click Organize Result Omissions.
  • Select C:\Users\User1\AppData
    where User1 is your username.
  • Click Remove.
  • Click Add Filter....
  • Check Omit files and folders.
  • Set the Filter to:
    regex:C:\\Users\\User1\\AppData\\(?!Local\\Lazy Nezumi Pro\\presets(\\|$))
    where User1 is your username.
  • Click OK.
  • Click OK.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: How to Ommit Appdata folder but include one folder inside Appdata?

Post by NotNull »

For other people finding this through a search, another example:

I want to exclude omit C:\windows, but with a few exceptions:

- the content of C:\Windows\TEMP should be shown, with all below
- Show the files in c:'windows\SYSTEM32, but not in subfolders
- Show the files in c:'windows\, but not in subfolders.

As an Everything Filter, this would look like:
!C:\Windows\ | c:\windows\temp\ | <file: parent:c:\windows> | <file: parent:c:\windows\system32>


Result Omissions:

1. Omit Files and Folders

Code: Select all

regex:c:\\windows\\(?!temp\\)(?!system32\\[^\\]*$)(?![^\\]*$)
2. Omit Folders

Code: Select all

regex:c:\\windows\\(system32\\|(?!system32)(?!temp))
The second one is needed because regular expressions are not aware if something is a file or a folder. It is just text to regex.


Activating this omission is a little slow initially ( a one-time action), but makes Everything even faster after that.
Didn't time it, though.
hellen_dorandt89
Posts: 52
Joined: Sun Apr 03, 2022 5:52 pm

Re: How to Ommit Appdata folder but include one folder inside Appdata?

Post by hellen_dorandt89 »

Aaaah. I thought I had replied to you gentlemen after I originally read this, I did not!! Thanks so much for helping me figure this out! much appreciated!
phil2search
Posts: 23
Joined: Tue Mar 20, 2018 9:04 pm

Re: How to Ommit Appdata folder but include one folder inside Appdata?

Post by phil2search »

Hello,

sorry. I am still confused...

If I understand the post above: using in files and folders
regex:C:\\Users\\User1\\AppData\\(?!Local\\Lazy Nezumi Pro\\presets(\\|$))
should exclude all AppData except C:\Users\User1\AppData\Local\Lazy Nezumi Pro\presets

So
regex:C:\\ProgramData\\(?!Microsoft\Windows\Start Menu\Programs(\\|$))
should exclude all programdata except the start menu programs folders
except that I still see all files in programdata.

regex:C:\\ProgramData\\(?!Microsoft\\Windows\\Start Menu\\Programs\\)(?![^\\]*$) filters the files
But I can't figure out the filter to hide the folders in ProgramData.

What am I missing ?
Does it need to be that complicated?

Thanks for any suggestion
Philippe
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: How to Ommit Appdata folder but include one folder inside Appdata?

Post by NotNull »

phil2search wrote: Sat Jul 02, 2022 2:11 pm regex:C:\\ProgramData\\(?!Microsoft\Windows\Start Menu\Programs(\\|$))
should exclude all programdata except the start menu programs folders
except that I still see all files in programdata.
You need to escape the backslashes in the path with an extra \ and use "" for the whole regualr expression as the path contains a space:

Code: Select all

regex:"C:\\ProgramData\\(?!Microsoft\\Windows\\Start Menu\\Programs(\\|$))"
phil2search
Posts: 23
Joined: Tue Mar 20, 2018 9:04 pm

Re: How to Ommit Appdata folder but include one folder inside Appdata?

Post by phil2search »

Thanks. You are right. I forgot to protect the \ and the space.
However: it still does not work for me and everything in programdata shows when omit is enabled:
2022-07-03 10_37_21-programdata - Everything (1.5a) 1.5.0.1315a (x64).png
2022-07-03 10_37_21-programdata - Everything (1.5a) 1.5.0.1315a (x64).png (35.67 KiB) Viewed 3140 times
Now, if I put the same regex in an interactive search in a regular window: it works as intended (=it excludes the files I want to omit).

Code: Select all

c:\programdata !regex:"C:\\ProgramData\\(?!Microsoft\\Windows\\Start Menu\\Programs(\\|$))"
Similarly, if I put the following regex in a regular window (I just want to keep showing the program shortcuts ending in lnk), it works (=it gets all the other files).

Code: Select all

regex:C:\\ProgramData(?!.*lnk$)(.*)
But if I put the expression in the omit filters, then it hides all files and folders including the shortcuts.
2022-07-03 11_12_08-Organize Result Omissions.png
2022-07-03 11_12_08-Organize Result Omissions.png (12.32 KiB) Viewed 3140 times
By the way: if I put quotes around it

Code: Select all

regex:"C:\\ProgramData(?!.*lnk$)(.*)"
then it still works in an interactive search but once in the omit filter, it does not hide anything anymore. So the quote seems to be understood differently.
2022-07-03 11_14_08-c__programdata - Everything (1.5a) 1.5.0.1315a (x64).png
2022-07-03 11_14_08-c__programdata - Everything (1.5a) 1.5.0.1315a (x64).png (28.62 KiB) Viewed 3140 times
So I still don't get it. Probably missing something obvious.
I am immensely ignorant about regex but shouldn't the interactive search and the omit give similar results? In other words, shouln't

Code: Select all

somesearch !regex:someexpr
in an interactive window give the same result as

Code: Select all

regex:someexpr
as an omit filter?
If not, how to test the omit filter? Is there somewhere a place where the expected behavior is described?

Thanks for everything and for your patience
Philippe
phil2search
Posts: 23
Joined: Tue Mar 20, 2018 9:04 pm

Re: How to Ommit Appdata folder but include one folder inside Appdata?

Post by phil2search »

As a follow up, I just tried and the regex work when in the filter definition.
e.g. to hide all contents of programdata program file etc. except links and executable, etc. etc. + users appdata contents:

Code: Select all

!regex:C:\\Program(?!.*(lnk|exe)$)(.*) !regex:C:\\Users\\(.*)\\AppData  
So either I did not understand the purpose of omit, or there is bug.
But since filters work, I'll use that.
Thanks
Philippe
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: How to Ommit Appdata folder but include one folder inside Appdata?

Post by NotNull »

I just took a fresh look a this. What is happening (according to my current level of understanding) is the following:
(comparing a directory tree to an actual tree)

Typically, omitting a folder "c:\programdata" would 'cut off' the branch at this location. All branches and leaves below it ( = files and folders) will be dropped.
When you want to keep c:\ProgramData\Microsoft\Windows\Start Menu\Programs, you need to make sure that the branches are not cut off at any of the points between them as that would make drop the remainder of the branch.

In the previous solution, we made an exception for C:\ProgramData\Microsoft\Windows\Start Menu\Programs, but not for C:\ProgramData\Microsoft , C:\ProgramData\Microsoft\Windows\Start Menu and any other folder in between. Which would cause the branch to be cut off at any of these points. Leaving you with just C:\programdata


There is a solution to that. With the following Omit Result filter, the intermediate nodes are "saved":
(Omit files and folders)

Code: Select all

regex:C:\\ProgramData\\(?!Microsoft$)(?!Microsoft\\Windows$)(?!Microsoft\\Windows\\Start Menu$)(?!Microsoft\\Windows\\Start Menu\\Programs(\\|$))
There are probably shorter regexes to get to the same result, but that would make the solution even more unreadable due to nesting.


phil2search wrote: Sat Jul 02, 2022 2:11 pm Does it need to be that complicated?
I thought about this. Unfortunately, yes. There are too many exceptions (and exceptions to these exceptions) possible to be handled in a GUI. That would definitely lead to what I call a "spaghetti-solution".
The current way is a complex surgical bypass operation (tree surgeon in this case ;)), but it is a structured solution ...

phil2search wrote: Sun Jul 03, 2022 9:30 am By the way: if I put quotes around it
Turns out that the better way in Omit REsult filters is to stay away from quotes! Didn't know that. Thank you for this lesson! (hope I don't forget this for the next time..)


This time it is tested ... :D
phil2search
Posts: 23
Joined: Tue Mar 20, 2018 9:04 pm

Re: How to Ommit Appdata folder but include one folder inside Appdata?

Post by phil2search »

So Omit would work at the folder level before the search (excluding a folder excludes all what is below) while filter would consider individual items (making a filter to exclude the parent excludes only the parent and not the children items)?
The first one sounds really difficult based on your example for anything else than excluding a tree (so difficult it may severely limit the use).
If it is like that, perhaps it would also be better named 'omit from search' than 'omit result'?

Anyways, I'll stick to filters then (which gives the expected result = results are filtered).
Thanks
Philippe
Post Reply