Using 'Select' to get a lister to display all files but only sub folders with contents larger than 500k

Using 'Select' to get a lister to display all files but only sub folders with contents larger than 500k.

Okay so far I've gone into Prefs / File Operations / Filters and set: 'Subfolder size >=512mb' for a new filter called 'Exists' i.e.:


I've created a button containing:

Select "Exits" FILTER

On hitting the button I just get all files selected, nothing changes on the folders.

Forget the Subfolder stuff, and try setting the filter closer to what I had posted in the other thread:

Type : Match : [Folders Only]
And
Size : Match : Is less than : 512 : KB

But honestly, I think the challenge you're going to have is how to apply the filter (which is tested and does work as intended to SELECT with the command: Select FILTER Exists) to what is DISPLAYED. Select is a one-time operation when you click the button that runs the command. You need the filter to be applied in your layout every time you change folders.

Unless I'm missing something simpler, this might be a job for a script of some kind... Hopefully there's some scripting interface that is more appropriate to use - but if nothing else, and you are still looking to tie this behavior to a LAYOUT, then perhaps we could write a script as an AfterFolderChange event handler which looks at the current lister layout name, and if it's your special layout name - every time you change folders the script could then apply the filter and then HIDE non-matching items (or some variation of that idea). Leaving you with just what you want to see....

Okay I've set as per:


And I'm now seeing files being selected but all sub-folders (irrespective of content size) are still visible / not selected.

I think I may as well give up on this one as it was a 'nice to have' that I can manage without.

The Select command selects things by default.

Select "Exits" FILTER on its own is just going to select things that match your Exits filter.

The Select command can hide things, but if you want it to do that you have to tell it. Add the HIDESEL argument:

Select "Exits" FILTER HIDESEL

Select command documentation.

Note that what gets hidden is just what matches the filter when you run the command. You'll need to re-run the command again if you want it to hide more things, and you'll need another command (or some more arguments, possibly), if you want to un-hide things that were previously hidden should the folder sizes change.

And based on what you said you want to have happen:

I'd say do what Leo just said by adding the HIDESEL argument (Select FILTER "Exists" HIDESEL)

But I don't think you need the 'subfolder' clause. Just make sure your filter looks like this:


SORRY... set the size field option to Is less or equal to...

Right this is working nicely now! :slight_smile:

I guess that if I wanted a second click on that button to remove the filter you'd need a 'Select NOPATTERN SHOWHIDDEN' command in there but that'd be dependant on the system knowing that a selection was in place and need a bit of logic to run it? Mind you is it worth working that lot out when a refresh will kill the selection?

Try it. It should work on its own.

The refresh via F5 does revert it back to the filtered down list. Reclicking the button does nothing.

I meant try the Select NOPATTERN SHOWHIDDEN idea you had.

Right, is there a way to assign that to the same button used originally though? If not its just as easy to hit F5.

What is really needed is:

If FILTER=true
Select NOPATTERN SHOWHIDDEN
else
Select FILTER "Exists" HIDESEL
endif

In the arguments box, but I guess 'FILTER=true' testing does not exist. :slight_smile:

You might be able to set a variable or something to make a toggle button but I'm not sure how easy that would be. F5 or a separate button (or right-click action on the main button) is easier.

The advantage of the ...SHOWHIDDEN command over F5 is you won't lose current selections or cached column data.

This..

Since FILTERFLAGS=hide is used instead of HIDESEL, only those folders are affected, that really match the filter.
The variants posted before, would also hide currently selected folders that do not match the filter, just saying. o)

[code]@toggle:if $src:HiddenFolders<512kb

@ifset:$src:HiddenFolders<512kb
@set src:HiddenFolders<512kb
@set src:HiddenFolders<512kb.bfc.drop
Select NOPATTERN SHOWHIDDEN

@ifset:else
@set src:HiddenFolders<512kb=1
@set src:HiddenFolders<512kb.bfc.drop=always
Select "Folders below 512KB" FILTER FILTERFLAGS=hide[/code]

Forgot:
Make sure to adjust the filtername used ("Folders below 512KB") or rename your filter like that. The purpose of the AutoVars addin is to get rid of the "pressed" button, once the filtered view is reset by changing the folder (navigating up/down/away).

Just set it up and that is exactly what I wanted to achieve. My thanks!