Batch thumbnail replacing for Rhino Materials

Hello everyone.

Recently I’ve discovered there’s a possibility to replace a thumbnail of the Rhino Material File (.mtl). I have plenty of my own materials and replacing their thumbnails would make it really easy to orient within them.

But I wonder – is there any easy way to replace thumbnails of multiple files all at once? Either by scripting or with help of some grasshopper add-on?

Specifically, I have a folder of the materials and a folder of their jpg previews with corresponding names.
image

image

I would really appreciate any help with this.
Thanks!