How to search files of a certain extension UNLESS they are in a certain folder?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
harryray2
Posts: 1104
Joined: Sat Oct 15, 2016 9:56 am

How to search files of a certain extension UNLESS they are in a certain folder?

Post by harryray2 »

How does this work for subfolders and folders with a space?


regex:^(?!d:\\misc\\).*\.lnk$ works, but what if I want it to work for:
d:\all misc\
d:\misc\all misc
void
Developer
Posts: 16748
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to exclude files of a certain extension UNLESS they are in a certain folder?

Post by void »

Spaces are treated as literal in exclude filters.

For example:
regex:^(?!d:\\all misc\\).*\.lnk$
harryray2
Posts: 1104
Joined: Sat Oct 15, 2016 9:56 am

Re: How to exclude files of a certain extension UNLESS they are in a certain folder?

Post by harryray2 »

Apologies, I should have said in search as opposed to the exclude filters
void
Developer
Posts: 16748
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to search files of a certain extension UNLESS they are in a certain folder?

Post by void »

Please use double quotes (") to escape spaces in a search:

For example:
regex:"^(?!d:\\all misc\\).*\.lnk$"
harryray2
Posts: 1104
Joined: Sat Oct 15, 2016 9:56 am

Re: How to search files of a certain extension UNLESS they are in a certain folder?

Post by harryray2 »

Thanks, I was putting the double quotes in the wrong place.

How about for sub folders? Just in the to delete folder:
D:\new folder (2)\to delete

And all folders underneath to delete:
D:\new folder (2)\to delete\folder 1\folder 2\
void
Developer
Posts: 16748
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to search files of a certain extension UNLESS they are in a certain folder?

Post by void »

subfolders are included by default, if you don't want subfolders, please try the following:

regex:"^(?!D:\\new folder (2)\\to delete\\[^\\]*\.lnk$)"



This is easier without regex:

!*.lnk | "D:\new folder (2)\to delete\*.lnk"
(no subfolders)

!*.lnk | "D:\new folder (2)\to delete\**.lnk"
(subfolders)
Post Reply