Grouping Scheme for custom pattern?

I have a project with many PNG files which have a constant pattern of something like

_R.png
_S.png
_L.png

These suffixes mostly occur inside of a folder name called "frames".

What I'd like to do is set a scheme globally across the entire project-folders where DO groups all the PNG files by their suffixes in all folders called "frames" or something.

This way I can sort all my PNGs by the _R/_S/_L etc suffixes, because they are all PNGs, technically. I dont care about their prefixes and names since they are always the same. The main way I'd like to group all the files is by the underscore-letter pattern.

I was wondering if this is in Group-Schemes, but I dont know for sure? Like, I'd like to tell DO from a global level, in a script or something, the rules to tag or label or group the specific art files I have. I'm not sure how to go about it but it would help a lot.

Here's a first idea for a group scheme:

Right(Stem(value), 1)

This would group this list

like this

Paste this to Preferences / File Display Columns / Evaluator Groups:

XML
<?xml version="1.0"?>
<evalgroupscheme reverse="no" scheme_name="53007" sort="no">
	<eval>Right(Stem(value), 1)</eval>
	<groups enable="no" />
	<columns>
		<col default="no" id="0" />
	</columns>
</evalgroupscheme>

Sorry, that's close. I should have done an example:

I have thousands of images for a game where the frames are called stuff

image01_R
image01_L
image01_S
image02_R
image02_L
image02_S
image03_R
image03_L
image03_S

I'd like to be able to just group them with the suffix where the main image name stays the same, and the files are in PNG extension, and the Group Scheme automatically applies to any folder called "frames"

Add the scheme to a path format in Preferences / Folders / Folder Formats.

Ok, it seems I have 2 or 3 problems here:

1.I'd like to sort the files in the Evaluator by the underscore, letters, so I don't have

image01_R.png
image01_L.png
image01_S.png
image02_R.png
image02_L.png
image02_S.png
image03_R.png
image03_L.png
image03_S.png

But instead:

...
image01_L.png
image02_L.png
image03_L.png
...
...
image01_R.png
image02_R.png
image03_R.png
...

2.Once the schema is works: instead of applying it manually to one folder, I'd like to apply it by default to any folder in my C:\game\data, using recursive checking for any folder called frames within that path, so I assume Ill be using the Wildcard Path Format. I do not know how to write that in Regex for DO, specifically the recursive bit. I think it's

C:\\game\\data\\.*\\frames or C:\\game\\data\\.*\\frames\\

3.As far as I know, I think those are the main-limiters, I'd like to be able to configure the Grouping scheme where I could type it in like regex or something:

Scheme:

\w+_R\.png
\w+_L\.png
\w+_K\.png
\w+_R\.txt

That way, it sorts the files by the specific underscore-letter instead of any other preference, like Name/Data/etc in the columns; it should be the default Sort/Group method as we have hundreds of these folders

OK! I think I did it.

First, I re-wrote the matching pattern for the groups. I used this as a reference: Evaluator Groups [Directory Opus Manual] specifically the bit towards the bottom with the return and static groups thing

I made a new scheme in Evaluator Groups (in preferences), Add Scheme and its Definition was the Static Groups I wanted to display in the window. The code was re-written to something like

var1 = RegExS(value, "(.*_L\.png)");
var2 = RegExS(value, "(.*_M\.png)");
var3 = RegExS(value, "(.*_N\.png)");

if (var1 (value)) return 1;
if (var2 (value)) return 2;
if (var3 (value)) return 3;

The Static Group stuff is what the Grouping uses. And for the Columns tab in the window, i put it inside of names so it displays in the "Names" grouping when u right click.

SO THEN

I made a new Path Format in Folder Formats using "Add > Wildcard Path Format" I did something like C:\\game\\data\\spc\\.*frames

I applied the settings and pressed ok and closed any "edit-preference" windows so that the settings actually apply.

So now the Group option automatically applies to folders in the Wildcard path, and the logic is constantly checking for that regex for each group-type.

This is great, it's gonna save me so much time.

3 Likes