Folder Expansion and Filtering

Opi!
I make alot of use of the very nice Folder Expansion Feature
Prefs > File Displays > Folder Expansion

Consider the lister below.
Let us define 2 terms:
Parent location =

  • C:......\Site Photos.
  • This is the folder location that the lister shows.

Child location

  • C:......\Site Photos\2024-10-14 ODS Boom Gate
  • This is the expanded folder

In the top screenshot the Child Location has been expanded and it's contents as displayed.
The 2nd screenshot shows the same lister and expanded folder (Child Location) but with a filter applied to the Parent Location.
As you can see the filter applies to the Parent Location AND the Child Location.
Is it possible to change this so that the filter applies to the parent only?
I cannot find an option to do this..... but Opus has surprised me before!
If not perhaps it might be applied to the very long feature wish list!

You can already edit the filter to only apply to the parent.

1 Like

@Ixp thank you.
I feel like this is a silly question - how does one do that?
I have looked at the Filter Bar in some detail see below.
I have also looked through
Prefs >> Filtering and Sorting
But cannot find anything.

What am I missing?

The filter will always be applied to all items in the file display, so you need to modify the filter itself.

Here is an example that uses the Evaluator:

InStr(fullpath, "Boom") >= 0

image

1 Like

Hi @IXP
Thanks again for your kind help.
Your suggested filter does not seem to do the trick unfortunately.
See below.
The feedback you give is still very useful because I now know the limits|charater of the filter feature.
image

I have to work out a filter with the following logic:
("boom" is contained in the Parent) AND ("boom" is NOT contained in the Child)

I am most comfortable with Regular Expressions so I have played with them a but but to no avail.
One problem is that the literal backslash (Represented confusingly with a backslash as an escape charater in Regex i.e. "\\")
Is not available to be consumed by the regex filter.
So this works as expected:

.*boom.*

image

But this does not:

.*boom.*\\

image

I will update here if I find way :slight_smile:

The classic quick filter (with or without regex) works against the file name. Use the Evaluator mode to reference the file path.

I cannot for the life of me see how this might be done.
I have scoured the Evaluator Reference but nothing I can see.
Not sure how a scripted approach would work either.
I know I could use scripting to invoke internal commands in this case set QUICKFILTER variants.
But I could just do that directly and I am back to square one.

Let us fantascise that we have a script method.
Call it.
onGetFilterStatus
I know,,,, I know.
And let us imagine further that, like OnGetNewName, it is invoked individually for each file/folder selected.
And if some flag is set, then that file/folder is filtered.
Effectively a hide file/folder property for every individual file/folder in play.
Then I could imagine that, with alot of work, one might script solution.
Have I found that rare situation where Opus can actually not do something?
Or am I just not understanding my tools......?
Well if that does not tempt you then nothing will!!!!!!!
Haaaa!

Try

(IsDir(fullpath) && Match(name, "*Boom*")) || (IsFile(fullpath) && !Match(name, "*Boom*"))

Here's a button for easier testing. Note how the quotes got escaped.

XML
<?xml version="1.0"?>
<button backcol="none" display="both" hotkey_label="yes" label_pos="right" textcol="none">
	<label>QF53627</label>
	<icon1>#filterfolder</icon1>
	<function type="normal">
		<instruction>Set QUICKFILTERFLAGS=evalon,regexpoff,flatviewoff,ignorediacriticsoff,anywordoff,partialoff QUICKFILTER=&quot;(IsDir(fullpath) &amp;&amp; Match(name, &quot;&quot;*Boom*&quot;&quot;)) || (IsFile(fullpath) &amp;&amp; !Match(name, &quot;&quot;*Boom*&quot;&quot;))&quot;</instruction>
	</function>
</button>

It seems to work for me :

image

A button with the following code works for me (or I didn't understand what you're looking for .... still an option :slight_smile: )

Set QUICKFILTER="InStr(fullpath, ""Boom"") >= 0"

I can't get this to work in a script. Both lxp's and PassThePeas' commands work when entered directly, but not in a FAYT script.

Using the code below on folder Test\, containing files Test.txt and Nope.txt,
quickfiltering Te will filter out Nope.txt when the folder is expanded.

// FAYT Quickfilter folders

var qff  = 'Set QUICKFILTERFLAGS=evalon QUICKFILTER="InStr(fullpath, ""_ReplaceMe_"") >= 0"';
var qffr = '_ReplaceMe_';

function OnInit(initData)
{
	initData.name           = "FAIT2 Quickfilter folders";
	initData.default_enable = true
}

function OnAddCommands(addCmdData)
{
	var cmd = addCmdData.AddCommand();
	cmd.name       = "FAIT2QuickfilterFolders";
	cmd.method     = "OnFAIT2QuickfilterFolders";
	//cmd.template   = "";

	var fayt       = cmd.fayt;
	fayt.enable    = true;
	fayt.key       = ".";
	fayt.label     = "FAIT2QuickfilterFolders";
	fayt.realtime  = true
}

function OnFAIT2QuickfilterFolders(scriptFAYTData)
{
 	var query = scriptFAYTData.cmdline;
	var cmd = DOpus.Create.Command();
	cmd.SetSourceTab(scriptFAYTData.tab);
	cmd.RunCommand(qff.replace(qffr, query));
}
1 Like

My guess is that this happens because you're creating a new Command object each time you type something, which doesn't have any items added to it.

At least in a quick test, this ready-to-use FAYT script will handle that and more (Although I've tested it with a much more advanced version than the one currently published)

1 Like

OMGoodness thanks guys!
Just walked in to work and see the above.
I have to err do some work but cant wait to get into this !!!

Thanks @PassThePeas
NOTE - This Post was edited

I have upgraded to latest stable
Directory Opus 13.11 Build 9081 x64 OS 10.0 (B:19045 P:2 T:1) SP 0.0
I found that enabling this seemed to help (Although i think this should just change the default?):

Now the top folder only works.
Note folders 2 and 3 (non empty) still have the same problem:

Removing the extra check boxes make no difference

  • Partial matching
  • Use Regular Expression