Wildcard/Regex folder formats for a specific folder tree level

Hi.

With this example folder tree in mind:

How can I apply a format to only "Level One" folders without it applying to their sub-folders? In the screenshot below, you can see that the "Use as the default format for all sub-folders" checkbox is not checked, but the format still applies to the sub-folders. I've tried using wildcards and other methods, but nothing seems to work. Here's my latest attempt:

Try ending the path with a $ instead of \\.

Tried that. didn't work. Tried ^ too, to match from the beginning. Nothing.

Are you sure you want to set folder formats? Or do you want to apply labels to folders?

.*Level One.*
hmmm - is applying to sub folders as well
in which case another wildcard fromat, but not regex, for all subfolders
*Level One*\*

That shouldn't be surprising. :slight_smile: "Level One" appears in the path of everything under a folder named Level One, and you're explicitly matching "Level One" with absolutely anything (or nothing) before and after it.

Lxp's suggestion is correct for Regex. If that isn't working, show us the regex you're using in case there's a misunderstanding about how to change that.

If you're expecting folder formats to affect items under expanded folders, that won't happen either. The format applies to the folder you are actually in, not any subfolders below it that you expand inline.

"Thank you everyone.

I made a mistake with my example folders. The folder structure in my example doesn't accurately represent my actual situation. In the example, @lxp is correct, but the folder names are arbitrary. I shouldn't have tried to simplify it. I apologize for the confusion I caused.

The actual folder structure is as follows:"

As you can see, there is no discernible pattern in the folder names. Now, referring to the screenshot below, I want to apply the format to levels 4 and 5 only.

yes, I do. I need to group and hide files in the Details view:


after the example folders goof I found out that everything's fine as long as I don't use a quantifier in the mix. I'd like to know what you think. thanks

No, I don't. That much I know! :grin: I just wanted you to see the whole folder structure.

Does the following regex work for you?

^([^\\]+?\\){4,5}[^\\]+$

You might have to change {4,5} with {3,4} depending on what you consider a "level" (i.e. is D:\ the first level or the 0th)


Explanation:
^ = start of the path
[^\\]+?\\ = read non-backslash characters until you encounter the first backslash (and include it)
( .. ){4,5} = do this 4 to 5 times
[^\\]+$ = read non-backslash characters until the end of the path.

The only paths matching this regular expressions are 4 or 5 levels deep, like
c:\a\b\c\d and c:\a\b\c\d\e


If you are only interested in these paths on the D:-drive:

^D:\\([^\\]+?\\){3,4}[^\\]+$ 

EDIT: added more code tags as the forum software messed up the layout.

1 Like

:100:
Wow! Thanks, man. It works like a charm :star_struck: Besides, your explanations rock. :metal: Thanks a bunch :man_bowing: