Use of the Filter Bar to exclude certain files

I use the Filter Bar a lot (OPUS 11) to select only *.jpg, or only *.mp4 or both *.(jpg|mp4). I love it.

In the last example, *.(jpg|mp4), how can I also exclude certain files at the same time? Specifically, I would like to use this same filter to include images and movies, but also exclude any of those .jpg or .mp4 files containing a text phrase such as Drama or Romance etc. I cant find in the help file any instructions on more complex use of the filter bar. Are there a set of rules that can be perused?

Just on exclusion alone: I did work out how to filter for multiple words that might be in the file names. Just paste things like this in the Filter Bar:
*(highland| bride|billionaire|cowboy|Rogue)*
While I use this sort of mode a lot, it does not seem to allow for negative selection, ie all the files not containing those words. Can that be done?

I guess I am greedy wanting both positive and negative filtering at the same time?

AFAIK first of all you have to turn off "Partial matching" in "FAYT and Filter Bar Options" in the settings. Then the proper expression for this filter will be something like ~(*(Drama|Romance)*).(jpg|mp4).

If you need more information about pattern matching synthax you can read it here.

And a question for Leo, is it possible to use negative expressions without turning off partial matching, some special sign?

Thanks a lot for the tips Sh1ro! Your suggestion works perfectly so far. Seems all I needed was a tilde for negation. I will check up on the other functions in the morning. but tonight, very happy here :slight_smile:

These days, the "partial matching" option is ignored if the pattern starts with a ~. This is because negation and partial matching are incompatible concepts; some part of every string doesn't match every wildcard. So you can normally leave partial matching on, unless you are using a very old version of Opus (before May 2012 / Opus 10.1.)

Partial matching is also automatically disabled for patterns that explicitly start or end with a * (unless using a very old version).

Combining positive and negative wildcards together can be tricky, but this will find the .jpg and .mp4 files that don't have Romance or Drama in their names, if partial matching is off in Preferences:

(~(*(Romance|Drama)*)).(jpg|mp4)

[Edit: That's the same pattern Sh1ro came up with but with some extra brackets. I'm not sure if my extra brackets actually matter.]

If partial matching is on in Preferences, that pattern won't do much, but you can add a * to the end to make it work. The explicit * on the end signals to Opus that you don't want partial matching at the moment:

(~(*(Romance|Drama)*)).(jpg|mp4)*

That last pattern is a bit sloppy, since it'll match things with .jpg or .mp4 in the middle of the filename and something else after them, but is probably fine in practice.

~(*(Romance|Drama)*).(txt|jpg)* also seems to work with partial matching left on, although I'm not sure why. :slight_smile: Maybe the extra brackets I was adding don't actually do anything.

Combining positive and negative patterns can be confusing as it often brings in very subtle but important issues. I'd recommend using a Find or Select filter and two separate wildcards in most cases.

You're welcome! :slight_smile:

That's exactly what I was looking for. But now for some reason when negative/positive expression is used filter returns incorrect results:
"Partial matching" is on







"Partial matching" is off




I have attached full contents of the folder that is on the screenshot. Could you please check it out? My Directory Opus version is 12.3.
New folder.7z (3.79 MB)

What's incorrect there?

Sorry, everything is fine. I was just thinking about txt extension while actually looking at jpg. I feel so stupid. :blush:

I guess two nights without a sleep is too much even for me.

And thank you for the hint about * sign and partial matching.

No worries, I did the same when testing earlier, and wondered if it was me doing it again. :smiley: Easily done.

Overall, these ideas have helped me a lot with a large task I have put off for a long time as too tedious (DOPUSv11).
The final search I use is now:
~(*(__B)*|*(__A)*)*.(jpg|jpeg|png|mp4|avi|mkv)

Its probably sloppy, but allows me to find images and movies that don't have my code __B or __A in the file name. There are multiple other file types in the folder, like .srt etc etc, but now they are hidden.
Now I can simple see which films have cover art in the format or not that I want. I can easily see those lacking a cover jpg and can go get it. Its very helpful.

I am aware of the potential for sloppy searches with negation included, but I am not deleting any files, just trying to find them and add new ones. For this purpose it is quite safe. But yeah, there is a minor risk to consider for other tasks than mine.

Thanks for all the feedback.. Love this community!