# Is there a way to merge multiple blend files?

I have around 100 separate .blend files that have one material each, is there a way to merge the materials from all of these blend files into one?

I am trying to do this to add the materials into the asset browser without having to merge them and add each material one by one, so I can easier manage my asset browser.

I'll assume that your files are placed in the same directory—or a couple of folders deep in the same directory. If so, in the file browser that pops up when you click File > Append, you can switch the Recursion level of your display to one of three levels to see all append-able data blocks present in the .blend files from that folder:

You probably don't want to see all data blocks, so you might wanna filter out the rest and only leave Shading on:

Now you should be able to select multiple materials from different files at once to append.

• Thanks a lot, by any chance is it possible to mark all materials in a blend file as asset? Mar 14 at 23:01
• Not in front my computer atm so I can't check but if you switch the Outliner to the "Blender File" mode you should see a list of all data blocks in the file: docs.blender.org/manual/en/latest/_images/… You might be able to select multiple materials at once and mark as asset there? Mar 14 at 23:24
• this worked.... Mar 15 at 1:00

EDIT: to read all materials, you don't want to use bpy.ops.wm.append but rather you want to use library management code. Updated the answer to reflect this.

There is no automatic way to do this. The manual way is to open a new blend file and append the materials from each of the 100 other files to that file and then save it.

You could write a Python script to do that. If, for instance, all of the blend files were in the same directory, the script could iterate through each file, appending every material from that file using bpy.data.libraries.load Here's an example of doing that modified from the matlib manager addon

with bpy.data.libraries.load(blend) as (data_from,data_to):
data_to.materials = data_from.materials


Note that this is equivalent to linking the material, but now you have a list of names. If you want to append instead, you would then go through the list and call bpy.ops.wm.append for each material.

Here is the starting point for code to accomplish this. It's only a starting point because it doesn't handle the error cases, like not being able to open a given blend file and it doesn't do any filtering.

import bpy
from pathlib import Path

blendfilespath = Path(PATH_TO_MATERIALS_DIRECTORY)

for file in blendfilespath.glob("*.blend") :
file_path = Path(file)
inner_path = "Materials"