GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Sort/Group files/folders by Filter

#1

One of the few remaining major things that I can't seem to be able to replicate from my TotalCommander setup is file/folder groups, so I'd like to describe what I've tried to do and ask for suggestions.

The system I have allows for a very consistent folder layout and greatly simplifies folder content discovery and browsing (coupled with custom colors that I can fully replicate in Opus via filters and label assignment) and also the only system that makes me not afraid to go to the \Users\Username folder :slight_smile:, which I've abandoned long ago due to the mess created by all the apps that don't allow any customization of where they put their junk in.
It takes into account both file/folder names as well as attributes and is roughly as follows:
Files
[ol]
[li] Few groups prioritized to be sorted at the top, e.g. Documents, MultiMedia, Links, Executables — with customizable order. This I can replicate in Opus via custom File Type Group names that start with numbers and then using one of the scripts I've found on this forum (see links below) to sort by column containing these File Type Groups.[/li]
[li] Everything else in between. This I can't replicate because I can't make Unspecified group to be placed above selected groups in 3), it can only be either at the top or at the bottom if I sort by Group even though those groups have names that are alphabetically below (staring with "z"). Is it maybe possible to make sorting by Group column depend only on alphabet so that Unspecified would be shown above zJunkFiles?[/li]
[li] Few groups de-prioritized to be sorted always at the bottom, e.g. temp files, thumbs.db, hidden and system files and other "junky" items (again, with ability to assign different priorities). This I can't replicate because I don't know how to add file attributes to the filtering mix, nor do I know how to force some groups to be below ungrouped files[/li][/ol]
Within each group files are sorted by name via a regular click on the "Name" column.

Folders — a simpler version
[ol]
[li] Git/SVN folders at the top[/li]
[li] Everything else in between[/li]
[li] Dotfolders/hidden folders at the bottom[/li][/ol]

Now, if only it were possible to sort by Filters, I could easily create all the required filters (be it filters matching my File Type Groups or "everything else not matching any of the file type groups" or custom wildcards etc.). However, as far as I understand, that's not currently possible (or is it?)

Below are some of the resources I've checked on custom file/folder groups, but they don't seem to completely cover what I'm looking for (or maybe I've missed something)
link 1
link 2
link 3
link 4

#2

You can sort by filters, by setting up Labels which use filters, then showing the label column and sorting by that.

Even more esoteric sorting can be done using script columns, which are basically unlimited.

#3

That was the first thing I tried, but the labels column is simply empty. It only shows labels that I assign manually, but not the labels assigned automatically via filters. I'm already using this process to assign colors to different folders/files, so I know labels are applied and labels depend on filters (colors work). However, none of this has any effect on the label column, so can't be used for Label column and hence for file sorting.
Is this just something of a 12 beta bug?

#4

That rings a bell, actually. Someone reported it quite recently but it hasn't been investigated yet.

A script column is probably the way to go, in that case.

#5

Ok, thanks. Do you know any custom column script that uses filters? I've searched around, but this is a big forum, so might've missed something. Would also be helpful to see an example of how labels/filters are referenced. Also, are internal scripts that make default columns available? That would also help if maybe I could take the current label column and just manually added the labels I'd like it to use in displaying.
Thanks for any tips

#6

It's probably easier to put the logic in the script itself and avoid filters entirely, if you're using a script. You can do more that way, and everything stays in one place.

#7

Maybe, though ideally I'd like to avoid that so that I only have one "source of truth" as to what e.g. a Document is rather than have duplicate filters that might end up being different.

#8

Scripts can use "grp:Documents" style wildcards to match anything with an extension in the Documents file type group, so you could still have that defined in only one place.