.GetMatch using ** glob pattern is inconsistent


I’ve a question regarding .GetMatch and how I should go about matching a resources at any level within the assets folder. This is what I’m doing:

{{ $cardimage := resources.GetMatch (print "/**/" "photo.jpeg") }}

This finds the resource as long as it’s not within the top level folder, i.e. assets/somefolder/photo.jpeg works, but assets/photo.jpeg doesn’t. It could very well be that I don’t understand glob patterns as well as I thought, but doesn’t ** mean any sub level including zero?

Anyway, how do I go about matching resources at any level?

Thanks in advance,

I’m pretty sure it’s consistent (that’s what computers do the best) (it may produce wrong result, but that’s something else).

Your Glob pattern is skipping the first level.

Have your tried:

{{ $cardimage := resources.GetMatch "**photo.jpeg" }}


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.